From 54ac10780f0320fa7e1d79112d974279545503a6 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 9 Oct 2014 20:39:18 +0000 Subject: [PATCH] Always return pathname in dl_iterate_phdr's dlpi_name, as Linux does Linux LD_ITERATE_PHDR(3): The dlpi_name field is a null-terminated string giving the pathname from which the shared object was loaded. That functionality is much more useful than returning just the short name. Approved by: kan Sponsored by: The FreeBSD Foundation --- libexec/rtld-elf/rtld.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index b1337c0ed08c..cc7afdad60ba 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3377,8 +3377,7 @@ rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info) { phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; - phdr_info->dlpi_name = STAILQ_FIRST(&obj->names) ? - STAILQ_FIRST(&obj->names)->name : obj->path; + phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); phdr_info->dlpi_tls_modid = obj->tlsindex;