summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/lt_path.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c
index d5b2a87..76c465b 100644
--- a/src/core/lt_path.c
+++ b/src/core/lt_path.c
@@ -407,10 +407,29 @@ static struct lt_modctx * lt_dlopen_locked(
struct lt_modctx * lt_dlopen(const char * module)
{
+ char * dot;
+ size_t slen;
struct lt_modctx * modctx;
const char * extv[2] = {"",0};
+ char dsobuf[PATH_MAX];
lt_slock();
+
+ if ((slen = strlen(module)) >= PATH_MAX) {
+ lt_setstatus(0,SLTDL_SYSTEM_ERROR);
+ lt_sunlock(0,lt_status);
+ return 0;
+ }
+
+ strcpy(dsobuf,module);
+
+ if ((dot = strrchr(dsobuf,'.')))
+ if (!strcmp(dot,".la"))
+ if ((slen = (dot - dsobuf)))
+ if (PATH_MAX - slen > strlen(OS_LIB_SUFFIX))
+ strcpy(dot,OS_LIB_SUFFIX);
+
+ module = dsobuf;
modctx = lt_dlopen_locked(module,extv,RTLD_NOW);
lt_sunlock(0,lt_status);
return modctx;