diff options
| author | Ulrich Drepper <[email protected]> | 2005-08-15 22:19:26 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2005-08-15 22:19:26 +0000 |
| commit | e5294612b9ea64b36b9c5d41b497d371d05d5a11 (patch) | |
| tree | 77c209524144bdefdeeed34853370f9d2c934ddc /libelf/elf_getarsym.c | |
| parent | e48c05b6262663024aba80365ebe003b64a3015d (diff) | |
Correct build programs caused by commit from devel tree.
elf_begin robustification.
Diffstat (limited to 'libelf/elf_getarsym.c')
| -rw-r--r-- | libelf/elf_getarsym.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 1dafa9ac..67b2697c 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -22,6 +22,7 @@ #include <assert.h> #include <byteswap.h> #include <endian.h> +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,6 +32,10 @@ #include "libelfP.h" +#define pread_retry(fd, buf, len, off) \ + TEMP_FAILURE_RETRY (pread (fd, buf, len, off)) + + Elf_Arsym * elf_getarsym (elf, ptr) Elf *elf; @@ -69,8 +74,8 @@ elf_getarsym (elf, ptr) { /* We must read index from the file. */ assert (elf->fildes != -1); - if (pread (elf->fildes, &elf->state.ar.ar_hdr, - sizeof (struct ar_hdr), elf->start_offset + SARMAG) + if (pread_retry (elf->fildes, &elf->state.ar.ar_hdr, + sizeof (struct ar_hdr), elf->start_offset + SARMAG) != sizeof (struct ar_hdr)) { /* It is not possible to read the index. Maybe it does not @@ -120,8 +125,8 @@ elf_getarsym (elf, ptr) uint32_t n; if (elf->map_address == NULL) { - if (pread (elf->fildes, &n, sizeof (n), - elf->start_offset + SARMAG + sizeof (struct ar_hdr)) + if (pread_retry (elf->fildes, &n, sizeof (n), + elf->start_offset + SARMAG + sizeof (struct ar_hdr)) != sizeof (n)) { /* Cannot read the number of entries. */ @@ -179,15 +184,17 @@ elf_getarsym (elf, ptr) char *new_str = (char *) (elf->state.ar.ar_sym + n + 1); /* Now read the data from the file. */ - if ((size_t) pread (elf->fildes, file_data, - n * sizeof (uint32_t), elf->start_offset - + SARMAG + sizeof (struct ar_hdr) - + sizeof (uint32_t)) != n * sizeof (uint32_t) - || ((size_t) pread (elf->fildes, new_str, - index_size - n * sizeof (uint32_t), - elf->start_offset - + SARMAG + sizeof (struct ar_hdr) - + (n + 1) * sizeof (uint32_t)) + if ((size_t) pread_retry (elf->fildes, file_data, + n * sizeof (uint32_t), + elf->start_offset + SARMAG + + sizeof (struct ar_hdr) + + sizeof (uint32_t)) + != n * sizeof (uint32_t) + || ((size_t) pread_retry (elf->fildes, new_str, + index_size - n * sizeof (uint32_t), + elf->start_offset + + SARMAG + sizeof (struct ar_hdr) + + (n + 1) * sizeof (uint32_t)) != index_size - n * sizeof (uint32_t))) { /* We were not able to read the data. */ |
