aboutsummaryrefslogtreecommitdiff
path: root/libelf/elf_next.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_next.c')
-rw-r--r--libelf/elf_next.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libelf/elf_next.c b/libelf/elf_next.c
index 605a593dd9e3..7da8ba6fe857 100644
--- a/libelf/elf_next.c
+++ b/libelf/elf_next.c
@@ -32,7 +32,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_next.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_next.c 2989 2014-03-17 09:56:46Z jkoshy $");
Elf_Cmd
elf_next(Elf *e)
@@ -48,13 +48,17 @@ elf_next(Elf *e)
return (ELF_C_NULL);
}
- assert (parent->e_kind == ELF_K_AR);
- assert (parent->e_cmd == ELF_C_READ);
+ assert(parent->e_kind == ELF_K_AR);
+ assert(parent->e_cmd == ELF_C_READ);
assert(e->e_rawfile > parent->e_rawfile);
- next = e->e_rawfile - parent->e_rawfile + e->e_rawsize;
+ next = e->e_rawfile - parent->e_rawfile + (off_t) e->e_rawsize;
next = (next + 1) & ~1; /* round up to an even boundary */
+ /*
+ * Setup the 'e_next' field of the archive descriptor for the
+ * next call to 'elf_begin()'.
+ */
parent->e_u.e_ar.e_next = (next >= (off_t) parent->e_rawsize) ?
(off_t) 0 : next;