From 54b252edec76bd7c5205c5f373ad36db8adc0fda Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 17 Mar 2024 01:44:28 +0000 Subject: lt_dlopen(): auto-convert .la suffix to OS_LIB_SUFFIX. --- src/core/lt_path.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') 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; -- cgit v1.2.3