diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-27 11:54:39 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-27 11:54:39 -0200 |
commit | 81736885429eb660aa39a210ef1ecddf347e001d (patch) | |
tree | a8a3dbfb7eef255a23eab724a4c6c88773b9cad5 /loslib.c | |
parent | 3ef5a6797f5aa7c7cb6b970d92b3c6d52d8e9aaf (diff) | |
download | lua-81736885429eb660aa39a210ef1ecddf347e001d.tar.gz lua-81736885429eb660aa39a210ef1ecddf347e001d.tar.bz2 lua-81736885429eb660aa39a210ef1ecddf347e001d.zip |
detail
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 | } |