diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-08-29 16:27:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-08-29 16:27:10 +0000 |
commit | fbe998a0b1be1f006bc72e5138fb38c188cc0433 (patch) | |
tree | bc00ddfec68454b8987056fbc1f1ace2da2597fa /libelf/elf32_updatefile.c | |
parent | b0bc2788cfa2012bfbcc68cac74cd39e3f5a8085 (diff) | |
download | elfutils-fbe998a0b1be1f006bc72e5138fb38c188cc0433.tar.gz |
merge of 333c187506c852455e9f7be44fa9adc360416217
and 79955b942e3f0ddc71117feea5754df61edcc42a
Diffstat (limited to 'libelf/elf32_updatefile.c')
-rw-r--r-- | libelf/elf32_updatefile.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 14893def..260fb346 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -20,6 +20,7 @@ #endif #include <assert.h> +#include <errno.h> #include <libelf.h> #include <stdbool.h> #include <stdlib.h> @@ -27,6 +28,7 @@ #include <unistd.h> #include <sys/param.h> +#include <system.h> #include "libelfP.h" @@ -326,7 +328,7 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp) /* This many bytes we want to write in this round. */ size_t n = MIN (filled, len); - if (unlikely ((size_t) pwrite (fd, fillbuf, n, pos) != n)) + if (unlikely ((size_t) pwrite_retry (fd, fillbuf, n, pos) != n)) { __libelf_seterrno (ELF_E_WRITE_ERROR); return 1; @@ -381,8 +383,8 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } /* Write out the ELF header. */ - if (unlikely (pwrite (elf->fildes, out_ehdr, - sizeof (ElfW2(LIBELFBITS,Ehdr)), 0) + if (unlikely (pwrite_retry (elf->fildes, out_ehdr, + sizeof (ElfW2(LIBELFBITS,Ehdr)), 0) != sizeof (ElfW2(LIBELFBITS,Ehdr)))) { __libelf_seterrno (ELF_E_WRITE_ERROR); @@ -441,10 +443,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } /* Write out the ELF header. */ - if (unlikely ((size_t) pwrite (elf->fildes, out_phdr, - sizeof (ElfW2(LIBELFBITS,Phdr)) - * ehdr->e_phnum, ehdr->e_phoff) - != sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum)) + size_t phdr_size = sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum; + if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr, + phdr_size, ehdr->e_phoff) + != phdr_size)) { __libelf_seterrno (ELF_E_WRITE_ERROR); return 1; @@ -544,10 +546,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) (*fctp) (buf, dl->data.d.d_buf, dl->data.d.d_size, 1); } - if (unlikely ((size_t) pwrite (elf->fildes, buf, - dl->data.d.d_size, - last_offset) - != dl->data.d.d_size)) + ssize_t n = pwrite_retry (elf->fildes, buf, + dl->data.d.d_size, + last_offset); + if (unlikely ((size_t) n != dl->data.d.d_size)) { if (buf != dl->data.d.d_buf && buf != tmpbuf) free (buf); @@ -593,9 +595,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* Write out the section header table. */ if (shdr_flags & ELF_F_DIRTY - && unlikely ((size_t) pwrite (elf->fildes, shdr_data, - sizeof (ElfW2(LIBELFBITS,Shdr)) - * shnum, shdr_offset) + && unlikely ((size_t) pwrite_retry (elf->fildes, shdr_data, + sizeof (ElfW2(LIBELFBITS,Shdr)) + * shnum, shdr_offset) != sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum)) { __libelf_seterrno (ELF_E_WRITE_ERROR); |