summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-17 01:44:28 +0000
committermidipix <writeonce@midipix.org>2024-03-17 01:50:40 +0000
commit54b252edec76bd7c5205c5f373ad36db8adc0fda (patch)
treed5a9f8796e5a2b325d57be0fbd2c0b884a2d9e0a /src
parentd4d5c91a7a8a3a83d8fc6e0966d0f63d41be8d5c (diff)
downloadsltdl-54b252edec76bd7c5205c5f373ad36db8adc0fda.tar.bz2
sltdl-54b252edec76bd7c5205c5f373ad36db8adc0fda.tar.xz
lt_dlopen(): auto-convert .la suffix to OS_LIB_SUFFIX.
Diffstat (limited to 'src')
-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;