diff options
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -340,9 +340,11 @@ static int load_aux (lua_State *L, int status, int envidx) { | |||
| 340 | 340 | ||
| 341 | 341 | ||
| 342 | static const char *getMode (lua_State *L, int idx) { | 342 | static const char *getMode (lua_State *L, int idx) { |
| 343 | const char *mode = luaL_optstring(L, idx, "bt"); | 343 | const char *mode = luaL_optstring(L, idx, NULL); |
| 344 | if (strchr(mode, 'B') != NULL) /* Lua code cannot use fixed buffers */ | 344 | if (mode != NULL && strchr(mode, 'B') != NULL) { |
| 345 | /* Lua code cannot use fixed buffers */ | ||
| 345 | luaL_argerror(L, idx, "invalid mode"); | 346 | luaL_argerror(L, idx, "invalid mode"); |
| 347 | } | ||
| 346 | return mode; | 348 | return mode; |
| 347 | } | 349 | } |
| 348 | 350 | ||
| @@ -425,7 +427,7 @@ static int dofilecont (lua_State *L, int d1, lua_KContext d2) { | |||
| 425 | static int luaB_dofile (lua_State *L) { | 427 | static int luaB_dofile (lua_State *L) { |
| 426 | const char *fname = luaL_optstring(L, 1, NULL); | 428 | const char *fname = luaL_optstring(L, 1, NULL); |
| 427 | lua_settop(L, 1); | 429 | lua_settop(L, 1); |
| 428 | if (l_unlikely(luaL_loadfile(L, fname) != LUA_OK)) | 430 | if (l_unlikely(luaL_loadfilex(L, fname, "bt") != LUA_OK)) |
| 429 | return lua_error(L); | 431 | return lua_error(L); |
| 430 | lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); | 432 | lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); |
| 431 | return dofilecont(L, 0, 0); | 433 | return dofilecont(L, 0, 0); |
