diff options
-rw-r--r-- | src/lj_load.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_load.c b/src/lj_load.c index dab037b4..d92bd1b4 100644 --- a/src/lj_load.c +++ b/src/lj_load.c | |||
@@ -88,12 +88,13 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename, | |||
88 | int status; | 88 | int status; |
89 | const char *chunkname; | 89 | const char *chunkname; |
90 | if (filename) { | 90 | if (filename) { |
91 | chunkname = lua_pushfstring(L, "@%s", filename); | ||
91 | ctx.fp = fopen(filename, "rb"); | 92 | ctx.fp = fopen(filename, "rb"); |
92 | if (ctx.fp == NULL) { | 93 | if (ctx.fp == NULL) { |
94 | L->top--; | ||
93 | lua_pushfstring(L, "cannot open %s: %s", filename, strerror(errno)); | 95 | lua_pushfstring(L, "cannot open %s: %s", filename, strerror(errno)); |
94 | return LUA_ERRFILE; | 96 | return LUA_ERRFILE; |
95 | } | 97 | } |
96 | chunkname = lua_pushfstring(L, "@%s", filename); | ||
97 | } else { | 98 | } else { |
98 | ctx.fp = stdin; | 99 | ctx.fp = stdin; |
99 | chunkname = "=stdin"; | 100 | chunkname = "=stdin"; |