summaryrefslogtreecommitdiffstats
path: root/libelf/elf_getshstrndx.c
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2005-08-29 16:27:10 +0000
committerUlrich Drepper <[email protected]>2005-08-29 16:27:10 +0000
commitfbe998a0b1be1f006bc72e5138fb38c188cc0433 (patch)
treebc00ddfec68454b8987056fbc1f1ace2da2597fa /libelf/elf_getshstrndx.c
parentb0bc2788cfa2012bfbcc68cac74cd39e3f5a8085 (diff)
merge of 333c187506c852455e9f7be44fa9adc360416217
and 79955b942e3f0ddc71117feea5754df61edcc42a
Diffstat (limited to 'libelf/elf_getshstrndx.c')
-rw-r--r--libelf/elf_getshstrndx.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libelf/elf_getshstrndx.c b/libelf/elf_getshstrndx.c
index 706092b7..a765f4e3 100644
--- a/libelf/elf_getshstrndx.c
+++ b/libelf/elf_getshstrndx.c
@@ -1,5 +1,5 @@
/* Return section index of section header string table.
- Copyright (C) 2002 Red Hat, Inc.
+ Copyright (C) 2002, 2005 Red Hat, Inc.
Written by Ulrich Drepper <[email protected]>, 2002.
This program is free software; you can redistribute it and/or modify
@@ -20,10 +20,12 @@
#endif
#include <assert.h>
+#include <errno.h>
#include <gelf.h>
#include <stddef.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -100,8 +102,9 @@ elf_getshstrndx (elf, dst)
the first one. */
Elf32_Shdr shdr_mem;
- if (pread (elf->fildes, &shdr_mem, sizeof (Elf32_Shdr),
- offset) != sizeof (Elf32_Shdr))
+ if (unlikely (pread_retry (elf->fildes, &shdr_mem,
+ sizeof (Elf32_Shdr), offset)
+ != sizeof (Elf32_Shdr)))
{
/* We must be able to read this ELF section header. */
__libelf_seterrno (ELF_E_INVALID_FILE);
@@ -116,15 +119,13 @@ elf_getshstrndx (elf, dst)
}
else
{
- size_t offset;
-
if (elf->state.elf64.scns.data[0].shdr.e64 != NULL)
{
num = elf->state.elf64.scns.data[0].shdr.e64->sh_link;
goto success;
}
- offset = elf->state.elf64.ehdr->e_shoff;
+ size_t offset = elf->state.elf64.ehdr->e_shoff;
if (elf->map_address != NULL
&& elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA
@@ -139,8 +140,9 @@ elf_getshstrndx (elf, dst)
the first one. */
Elf64_Shdr shdr_mem;
- if (pread (elf->fildes, &shdr_mem, sizeof (Elf64_Shdr),
- offset) != sizeof (Elf64_Shdr))
+ if (unlikely (pread_retry (elf->fildes, &shdr_mem,
+ sizeof (Elf64_Shdr), offset)
+ != sizeof (Elf64_Shdr)))
{
/* We must be able to read this ELF section header. */
__libelf_seterrno (ELF_E_INVALID_FILE);