From e76bb50d44702f601ec5dd167b03b475ed53860c Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 7 Apr 2025 10:27:40 +0200 Subject: Fix error generation in load*. Reported by Sergey Kaplun. #1353 --- src/lj_load.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lj_load.c b/src/lj_load.c index 90a61027..6c8ae9f1 100644 --- a/src/lj_load.c +++ b/src/lj_load.c @@ -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; -- cgit v1.2.3-55-g6feb