summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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));
}