diff options
Diffstat (limited to 'src/lj_clib.c')
-rw-r--r-- | src/lj_clib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lj_clib.c b/src/lj_clib.c index f016b06b..a7df719a 100644 --- a/src/lj_clib.c +++ b/src/lj_clib.c | |||
@@ -119,12 +119,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global) | |||
119 | RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); | 119 | RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); |
120 | if (!h) { | 120 | if (!h) { |
121 | const char *e, *err = dlerror(); | 121 | const char *e, *err = dlerror(); |
122 | if (*err == '/' && (e = strchr(err, ':')) && | 122 | if (err && *err == '/' && (e = strchr(err, ':')) && |
123 | (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) { | 123 | (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) { |
124 | h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); | 124 | h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); |
125 | if (h) return h; | 125 | if (h) return h; |
126 | err = dlerror(); | 126 | err = dlerror(); |
127 | } | 127 | } |
128 | if (!err) err = "dlopen failed"; | ||
128 | lj_err_callermsg(L, err); | 129 | lj_err_callermsg(L, err); |
129 | } | 130 | } |
130 | return h; | 131 | return h; |
@@ -384,6 +385,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name) | |||
384 | cd = lj_cdata_new(cts, id, CTSIZE_PTR); | 385 | cd = lj_cdata_new(cts, id, CTSIZE_PTR); |
385 | *(void **)cdataptr(cd) = p; | 386 | *(void **)cdataptr(cd) = p; |
386 | setcdataV(L, tv, cd); | 387 | setcdataV(L, tv, cd); |
388 | lj_gc_anybarriert(L, cl->cache); | ||
387 | } | 389 | } |
388 | } | 390 | } |
389 | return tv; | 391 | return tv; |