diff options
-rw-r--r-- | src/lj_clib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_clib.c b/src/lj_clib.c index 8dc3c10e..dc72dced 100644 --- a/src/lj_clib.c +++ b/src/lj_clib.c | |||
@@ -118,12 +118,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global) | |||
118 | RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); | 118 | RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); |
119 | if (!h) { | 119 | if (!h) { |
120 | const char *e, *err = dlerror(); | 120 | const char *e, *err = dlerror(); |
121 | if (*err == '/' && (e = strchr(err, ':')) && | 121 | if (err && *err == '/' && (e = strchr(err, ':')) && |
122 | (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) { | 122 | (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) { |
123 | h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); | 123 | h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); |
124 | if (h) return h; | 124 | if (h) return h; |
125 | err = dlerror(); | 125 | err = dlerror(); |
126 | } | 126 | } |
127 | if (!err) err = "dlopen failed"; | ||
127 | lj_err_callermsg(L, err); | 128 | lj_err_callermsg(L, err); |
128 | } | 129 | } |
129 | return h; | 130 | return h; |