summaryrefslogtreecommitdiff
path: root/ldso/ldso/readelflib1.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-06-18 22:42:23 +0000
committerEric Andersen <andersen@codepoet.org>2003-06-18 22:42:23 +0000
commit557e404d6595bed6be66076577b829a00f39eda4 (patch)
tree361c700610de267c069899ca3ccec93920752503 /ldso/ldso/readelflib1.c
parent20d8808116d749b626c080b2891c968f163966e6 (diff)
Be extra careful to memset the correct size, not the size of some random
pointer. Fix printing of '0x0x' in ldd output. Simplify discrimination of libname, so doing things like dlopen("./libfoo.so",RTLD_NOW) with a leading "./" in the path will work as expected. -Erik
Diffstat (limited to 'ldso/ldso/readelflib1.c')
-rw-r--r--ldso/ldso/readelflib1.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c
index 261505b1a..0290d6ccf 100644
--- a/ldso/ldso/readelflib1.c
+++ b/ldso/ldso/readelflib1.c
@@ -178,7 +178,7 @@ extern char *_dl_ldsopath;
struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname)
{
- char *pnt;
+ char *pnt, *pnt1;
struct elf_resolve *tpnt1;
char *libname;
@@ -190,10 +190,10 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if (_dl_strlen(full_libname) > 1024)
goto goof;
- while (*pnt) {
- if (*pnt == '/')
- libname = pnt + 1;
- pnt++;
+ /* Skip over any initial initial './' path to get the libname */
+ pnt1 = _dl_strrchr(pnt, '/');
+ if (pnt1) {
+ libname = pnt1 + 1;
}
#if defined (__SUPPORT_LD_DEBUG__)
@@ -207,7 +207,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname);
if (tpnt1)
return tpnt1;
- goto goof;
+ //goto goof;
}
/*
@@ -334,9 +334,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
tpnt = _dl_check_hashed_files(libname);
if (tpnt) {
if (*rpnt) {
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ (*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
(*rpnt)->next->prev = (*rpnt);
*rpnt = (*rpnt)->next;
(*rpnt)->dyn = tpnt;
@@ -602,9 +601,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
* Add this object into the symbol chain
*/
if (*rpnt) {
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ (*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
(*rpnt)->next->prev = (*rpnt);
*rpnt = (*rpnt)->next;
(*rpnt)->dyn = tpnt;