diff options
Diffstat (limited to 'loslib.c')
-rw-r--r-- | loslib.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.15 2005/12/15 18:17:49 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.16 2005/12/22 16:19:56 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | 22 | ||
23 | static int os_pushresult (lua_State *L, int i, const char *filename) { | 23 | static int os_pushresult (lua_State *L, int i, const char *filename) { |
24 | int en = errno; /* calls to Lua API may change this value */ | ||
24 | if (i) { | 25 | if (i) { |
25 | lua_pushboolean(L, 1); | 26 | lua_pushboolean(L, 1); |
26 | return 1; | 27 | return 1; |
@@ -28,10 +29,10 @@ static int os_pushresult (lua_State *L, int i, const char *filename) { | |||
28 | else { | 29 | else { |
29 | lua_pushnil(L); | 30 | lua_pushnil(L); |
30 | if (filename) | 31 | if (filename) |
31 | lua_pushfstring(L, "%s: %s", filename, strerror(errno)); | 32 | lua_pushfstring(L, "%s: %s", filename, strerror(en)); |
32 | else | 33 | else |
33 | lua_pushfstring(L, "%s", strerror(errno)); | 34 | lua_pushfstring(L, "%s", strerror(en)); |
34 | lua_pushinteger(L, errno); | 35 | lua_pushinteger(L, en); |
35 | return 3; | 36 | return 3; |
36 | } | 37 | } |
37 | } | 38 | } |