diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-03-07 20:50:12 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-03-07 20:50:12 +0000 |
commit | 05be150de5b914a478f1e7a146a4cdc137955652 (patch) | |
tree | ae4c5a9084e7f610762a11df7c4209fa1cd3a9a6 /libexec | |
parent | 51caa391a1a8caf6fd0ce585c17c160c308fa943 (diff) |
Fix bug not calling callback for the main executable object.
ok drahn@, espie@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/dlfcn.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index f750540c262..7bf01752a7e 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.42 2004/12/01 22:27:35 kurt Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.43 2005/03/07 20:50:11 kettenis Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -402,14 +402,18 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *data), for (object = _dl_objects; object != NULL; object = object->next) { ehdr = (Elf_Ehdr *)object->load_addr; - if (ehdr == NULL) + if (object->phdrp == NULL && ehdr == NULL) continue; info.dlpi_addr = object->load_addr; info.dlpi_name = object->load_name; - info.dlpi_phdr = - (Elf_Phdr *)((char *)object->load_addr + ehdr->e_phoff); - info.dlpi_phnum = ehdr->e_phnum; + info.dlpi_phdr = object->phdrp; + info.dlpi_phnum = object->phdrc; + if (info.dlpi_phdr == NULL) { + info.dlpi_phdr = (Elf_Phdr *) + ((char *)object->load_addr + ehdr->e_phoff); + info.dlpi_phnum = ehdr->e_phnum; + } retval = callback(&info, sizeof (struct dl_phdr_info), data); if (retval) break; |