]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix error generation in load*.
authorMike Pall <mike>
Mon, 7 Apr 2025 08:27:40 +0000 (10:27 +0200)
committerMike Pall <mike>
Mon, 7 Apr 2025 08:27:40 +0000 (10:27 +0200)
Reported by Sergey Kaplun. #1353

src/lj_load.c

index 90a61027adf19d413d8bcf2971373f581ea5de00..6c8ae9f154ac8582921674d4491ad441dabcd8fb 100644 (file)
@@ -108,8 +108,9 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename,
     copyTV(L, L->top-1, L->top);
   }
   if (err) {
+    const char *fname = filename ? filename : "stdin";
     L->top--;
-    lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err));
+    lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err));
     return LUA_ERRFILE;
   }
   return status;