diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-15 16:34:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-15 16:34:42 -0300 |
| commit | 62dd4cbe91617741a9f8e594201ad510d073b12d (patch) | |
| tree | 8f06d17151d8bd34f83ec956db03e60273a9f57d | |
| parent | ae5283dc368b7b2d5f0811f7b74860b46774bd8d (diff) | |
| download | lua-62dd4cbe91617741a9f8e594201ad510d073b12d.tar.gz lua-62dd4cbe91617741a9f8e594201ad510d073b12d.tar.bz2 lua-62dd4cbe91617741a9f8e594201ad510d073b12d.zip | |
check for errors while loading file
| -rw-r--r-- | ldo.c | 3 |
1 files changed, 2 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.168 2002/03/26 20:46:10 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.169 2002/04/10 12:10:54 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -447,6 +447,7 @@ LUA_API int lua_loadfile (lua_State *L, const char *filename) { | |||
| 447 | filename = lua_tostring(L, -1); /* filename = `@'..filename */ | 447 | filename = lua_tostring(L, -1); /* filename = `@'..filename */ |
| 448 | luaZ_Fopen(&z, f, filename); | 448 | luaZ_Fopen(&z, f, filename); |
| 449 | status = protectedparser(L, &z, bin); | 449 | status = protectedparser(L, &z, bin); |
| 450 | if (ferror(f)) status = LUA_ERRFILE; | ||
| 450 | lua_remove(L, nlevel); /* remove filename */ | 451 | lua_remove(L, nlevel); /* remove filename */ |
| 451 | if (f != stdin) | 452 | if (f != stdin) |
| 452 | fclose(f); | 453 | fclose(f); |
