summaryrefslogtreecommitdiffstats
path: root/lib/libelf/elf_getbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libelf/elf_getbase.c')
-rw-r--r--lib/libelf/elf_getbase.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libelf/elf_getbase.c b/lib/libelf/elf_getbase.c
index d32fa6c..863c858 100644
--- a/lib/libelf/elf_getbase.c
+++ b/lib/libelf/elf_getbase.c
@@ -34,12 +34,14 @@ __FBSDID("$FreeBSD$");
off_t
elf_getbase(Elf *e)
{
- if (e == NULL ||
- e->e_parent == NULL) {
+ if (e == NULL) {
LIBELF_SET_ERROR(ARGUMENT, 0);
- return (off_t) -1;
+ return ((off_t) -1);
}
+ if (e->e_parent == NULL)
+ return ((off_t) 0);
+
return ((off_t) ((uintptr_t) e->e_rawfile -
(uintptr_t) e->e_parent->e_rawfile));
}
OpenPOWER on IntegriCloud