|
@@ -119,12 +119,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global)
|
|
RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
|
RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
|
if (!h) {
|
|
if (!h) {
|
|
const char *e, *err = dlerror();
|
|
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))))) {
|
|
(name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) {
|
|
h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
|
h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
|
if (h) return h;
|
|
if (h) return h;
|
|
err = dlerror();
|
|
err = dlerror();
|
|
}
|
|
}
|
|
|
|
+ if (!err) err = "dlopen failed";
|
|
lj_err_callermsg(L, err);
|
|
lj_err_callermsg(L, err);
|
|
}
|
|
}
|
|
return h;
|
|
return h;
|
|
@@ -384,6 +385,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name)
|
|
cd = lj_cdata_new(cts, id, CTSIZE_PTR);
|
|
cd = lj_cdata_new(cts, id, CTSIZE_PTR);
|
|
*(void **)cdataptr(cd) = p;
|
|
*(void **)cdataptr(cd) = p;
|
|
setcdataV(L, tv, cd);
|
|
setcdataV(L, tv, cd);
|
|
|
|
+ lj_gc_anybarriert(L, cl->cache);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return tv;
|
|
return tv;
|