summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_getphdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf32_getphdr.c')
-rw-r--r--libelf/elf32_getphdr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c
index 25693687..341acf09 100644
--- a/libelf/elf32_getphdr.c
+++ b/libelf/elf32_getphdr.c
@@ -19,9 +19,11 @@
# include <config.h>
#endif
+#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -148,9 +150,10 @@ elfw2(LIBELFBITS,getphdr) (elf)
elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_MALLOCED;
/* Read the header. */
- if ((size_t) pread (elf->fildes,
- elf->state.ELFW(elf,LIBELFBITS).phdr, size,
- (elf->start_offset + ehdr->e_phoff)) != size)
+ ssize_t n = pread_retry (elf->fildes,
+ elf->state.ELFW(elf,LIBELFBITS).phdr, size,
+ elf->start_offset + ehdr->e_phoff);
+ if (unlikely ((size_t) n != size))
{
/* Severe problems. We cannot read the data. */
__libelf_seterrno (ELF_E_READ_ERROR);