diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2004-10-14 09:24:43 +0000 |
---|---|---|
committer | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2004-10-14 09:24:43 +0000 |
commit | f8b23fd8da1d342dfd4f5e67377d7c0f08eb3603 (patch) | |
tree | 52de626095fe17be35ce046c0bf0b92ebfebf77f | |
parent | c5618361f77f68f0e70bd7f87e040faacef2c5fe (diff) |
Don't SEGV if library not found.
-rw-r--r-- | ldso/libdl/libdl.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index aa19e81cc..b08254a49 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -216,20 +216,19 @@ void *dlopen(const char *libname, int flag) fprintf(stderr, "Trying to load '%s', needed by '%s'\n", lpntstr, tcurr->libname); #endif - dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf)); - _dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf)); - dyn_ptr = dyn_ptr->next; - dyn_ptr->dyn = tpnt1; - if (!tpnt1) { + if (tpnt1) { + tpnt1->usage_count++; + } else { tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr, 0); - dyn_ptr->dyn = tpnt1; if (!tpnt1) goto oops; - tpnt1->rtld_flags |= RTLD_GLOBAL; - } else { - tpnt1->rtld_flags |= RTLD_GLOBAL; - tpnt1->usage_count++; } + tpnt1->rtld_flags |= RTLD_GLOBAL; + dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf)); + _dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf)); + dyn_ptr = dyn_ptr->next; + dyn_ptr->dyn = tpnt1; + tmp = alloca(sizeof(struct init_fini_list)); /* Allocates on stack, no need to free this memory */ tmp->tpnt = tpnt1; tmp->next = tcurr->init_fini; |