Skip to content

Commit e76bb50

Browse files
author
Mike Pall
committed
Fix error generation in load*.
Reported by Sergey Kaplun. #1353
1 parent e9e4b6d commit e76bb50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lj_load.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename,
108108
copyTV(L, L->top-1, L->top);
109109
}
110110
if (err) {
111+
const char *fname = filename ? filename : "stdin";
111112
L->top--;
112-
lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err));
113+
lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err));
113114
return LUA_ERRFILE;
114115
}
115116
return status;

0 commit comments

Comments
 (0)