diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lt_path.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c index c0205d7..fee9522 100644 --- a/src/core/lt_path.c +++ b/src/core/lt_path.c @@ -399,16 +399,16 @@ static struct lt_modctx * lt_dlopen_locked( lt_modv_cap = <_modv_next[64]; } - /* dlopen (module) */ - if (module && !(maddr = dlopen(mpath,mode))) { + /* dlopen (module), dlopen (self) */ + if (!symtbl && !(maddr = dlopen(mpath,mode))) { free(mpath); lt_setstatus(0,SLTDL_ERR_DLFCN_ERROR); return 0; } /* module already dlopen'ed? */ - for (modctx=lt_modv_head; module && modctx; modctx=modctx->mnext) { - if (modctx->mpath && !strcmp(modctx->mpath,mpath)) { + for (modctx=lt_modv_head; maddr && modctx; modctx=modctx->mnext) { + if (modctx->maddr == maddr) { free(mpath); modctx->mrefs++; return modctx; @@ -451,13 +451,16 @@ struct lt_modctx * lt_dlopen(const char * module) lt_slock(); - if ((slen = strlen(module)) >= PATH_MAX) { + if (module && (slen = strlen(module)) >= PATH_MAX) { lt_setstatus(0,SLTDL_ERR_SYSTEM_ERROR); lt_sunlock(0,lt_status); return 0; } - strcpy(dsobuf,module); + if (module) { + strcpy(dsobuf,module); + module = dsobuf; + } if ((dot = strrchr(dsobuf,'.'))) if (!strcmp(dot,".la")) @@ -465,7 +468,6 @@ struct lt_modctx * lt_dlopen(const char * module) if (PATH_MAX - slen > strlen(OS_LIB_SUFFIX)) strcpy(dot,OS_LIB_SUFFIX); - module = dsobuf; modctx = lt_dlopen_locked(0,module,extv,RTLD_NOW); lt_sunlock(0,lt_status); return modctx; |