mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Workaround for platform dlerror() returning NULL.
Contributed by mcclure.
This commit is contained in:
parent
44382e833a
commit
478bcfe52a
@ -118,12 +118,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global)
|
||||
RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
||||
if (!h) {
|
||||
const char *e, *err = dlerror();
|
||||
if (*err == '/' && (e = strchr(err, ':')) &&
|
||||
if (err && *err == '/' && (e = strchr(err, ':')) &&
|
||||
(name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) {
|
||||
h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
||||
if (h) return h;
|
||||
err = dlerror();
|
||||
}
|
||||
if (!err) err = "dlopen failed";
|
||||
lj_err_callermsg(L, err);
|
||||
}
|
||||
return h;
|
||||
|
Loading…
Reference in New Issue
Block a user