From fbe998a0b1be1f006bc72e5138fb38c188cc0433 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 29 Aug 2005 16:27:10 +0000 Subject: merge of 333c187506c852455e9f7be44fa9adc360416217 and 79955b942e3f0ddc71117feea5754df61edcc42a --- libelf/elf32_updatefile.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'libelf/elf32_updatefile.c') 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 +#include #include #include #include @@ -27,6 +28,7 @@ #include #include +#include #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); -- cgit v1.2.3