]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Fix GetLastError() save/restore around ffi.load().
authorMike Pall <mike>
Fri, 25 Nov 2011 11:25:51 +0000 (12:25 +0100)
committerMike Pall <mike>
Fri, 25 Nov 2011 11:25:51 +0000 (12:25 +0100)
src/lj_clib.c

index 937b125830f1ec14366beec8b96c9999d37a8d5b..ff71346a0b6fdcc97b57ae5afcf1f868fe09057e 100644 (file)
@@ -185,8 +185,8 @@ static void *clib_loadlib(lua_State *L, const char *name, int global)
 {
   DWORD oldwerr = GetLastError();
   void *h = (void *)LoadLibraryA(clib_extname(L, name));
-  SetLastError(oldwerr);
   if (!h) clib_error(L, "cannot load module " LUA_QS ": %s", name);
+  SetLastError(oldwerr);
   UNUSED(global);
   return h;
 }