diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-03-20 07:44:12 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-03-20 07:44:12 +0000 |
commit | b9cba4882f2ceb4b6fe85f8558c8230b4fa01bf7 (patch) | |
tree | f720e4ae0051e42ed304fdd8049ea85ce5320b8c | |
parent | f473943d7301848fa75abfc4254916e4eb0151b2 (diff) |
Attempt to follow symlinks if possible, and use that directory
for the base library directory.
-Erik
-rw-r--r-- | ldso/ldso/ldso.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 370c844ba..825701dcd 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -653,11 +653,26 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a #endif INIT_GOT(lpnt, _dl_loaded_modules); } + /* OK, fill this in - we did not have this before */ if (ppnt->p_type == PT_INTERP) { - char *pnt, *pnt1; + int readsize = 0; + char *pnt, *pnt1, buf[1024]; tpnt->libname = _dl_strdup((char *) ppnt->p_offset + (auxvt[AT_PHDR].a_un.a_val & 0xfffff000)); + + /* Determine if the shared lib loader is a symlink */ + _dl_memset(buf, 0, sizeof(buf)); + readsize = _dl_readlink(tpnt->libname, buf, sizeof(buf)); + if (readsize > 0 && readsize < sizeof(buf)-1) { + pnt1 = _dl_strrchr(buf, '/'); + if (pnt1 && buf != pnt1) { +#ifdef DL_DEBUG + _dl_dprintf(2, "changing tpnt->libname from '%s' to '%s'\n", tpnt->libname, buf); +#endif + tpnt->libname = _dl_strdup(buf); + } + } /* Store the path where the shared lib loader was found for * later use */ |