summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-18 04:58:28 +0000
committermidipix <writeonce@midipix.org>2024-03-18 04:58:28 +0000
commitb2140451129070b2f0144914a9945cd43d4fe631 (patch)
tree6f2ba9e657747a8e3caa72a6d65d72e83aa1769b
parent1e07a83e6605d301246107c90ff3e4918c5b19e8 (diff)
downloadsltdl-b2140451129070b2f0144914a9945cd43d4fe631.tar.bz2
sltdl-b2140451129070b2f0144914a9945cd43d4fe631.tar.xz
lt_dlpathopen_locked(): bypass path-based search when module path is absolute.
-rw-r--r--src/core/lt_path.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c
index 76c465b..d3f7ec1 100644
--- a/src/core/lt_path.c
+++ b/src/core/lt_path.c
@@ -291,6 +291,21 @@ static int lt_dlpathopen_locked(
memcpy(path,module,mlen);
+ if (path[0] == '/') {
+ if ((fdmod = open(path,SLTDL_MODULE_OPEN_OPTIONS,0)) >= 0) {
+ if (mpath) {
+ if (!(*mpath = realpath(path,0))) {
+ close(fdmod);
+ return lt_setstatus(-1,SLTDL_SYSTEM_ERROR);
+ }
+ }
+
+ return lt_setstatus(fdmod,SLTDL_OK);
+ }
+
+ return lt_setstatus(-1,SLTDL_PATH_NO_ENTRY);
+ }
+
for (ppath=lt_pathv; ppath && *ppath; ppath++) {
fdat = open(*ppath,O_RDONLY|O_DIRECTORY|O_CLOEXEC,0);