summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-12-18 08:30:38 +0000
committermidipix <writeonce@midipix.org>2019-12-18 12:52:42 +0000
commit709fded02a8c12e6b67813f5e217504a3824b953 (patch)
tree68fb23819e074e6b589dcd53eefd123bd7842d80
parent7922cdc327550b54b8f69bb19ec7980b25f51058 (diff)
downloadsltdl-709fded02a8c12e6b67813f5e217504a3824b953.tar.bz2
sltdl-709fded02a8c12e6b67813f5e217504a3824b953.tar.xz
lt_dlpathopen(): refactor in anticipation of lt_dlopen().
-rw-r--r--src/core/lt_path.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c
index 6d72d85..bc9ac07 100644
--- a/src/core/lt_path.c
+++ b/src/core/lt_path.c
@@ -243,7 +243,7 @@ int lt_dlinsertsearchdir(const char * mark, const char * path)
return lt_sunlock(ret);
}
-int lt_dlpathopen(const char * module, const char ** extv)
+static int lt_dlpathopen_locked(const char * module, const char ** extv)
{
int fdat;
int fdmod;
@@ -258,8 +258,6 @@ int lt_dlpathopen(const char * module, const char ** extv)
memcpy(path,module,mlen);
- lt_slock();
-
for (ppath=lt_pathv; *ppath; ppath++) {
fdat = open(*ppath,O_RDONLY|O_DIRECTORY|O_CLOEXEC,0);
@@ -277,7 +275,7 @@ int lt_dlpathopen(const char * module, const char ** extv)
if (fdmod >= 0) {
close(fdat);
- return lt_sunlock(fdmod);
+ return fdmod;
}
}
@@ -285,5 +283,11 @@ int lt_dlpathopen(const char * module, const char ** extv)
}
}
- return lt_sunlock(-1);
+ return -1;
+}
+
+int lt_dlpathopen(const char * module, const char ** extv)
+{
+ lt_slock();
+ return lt_sunlock(lt_dlpathopen_locked(module,extv));
}