diff options
author | Lua Team <team@lua.org> | 2006-01-24 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2006-01-24 12:00:00 +0000 |
commit | b487a3dce43e449acf3852ec56345e2860cfeab7 (patch) | |
tree | 5aa380efa69c039aafa812cf9edeb432bf27a885 /src/liolib.c | |
parent | 4f266285f998d0d14c4e83cc29772f0de1a7fbba (diff) | |
download | lua-github-5.1-rc2.tar.gz |
Lua 5.1-rc25.1-rc2
Diffstat (limited to 'src/liolib.c')
-rw-r--r-- | src/liolib.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/liolib.c b/src/liolib.c index f0a7602a..fd7894c9 100644 --- a/src/liolib.c +++ b/src/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.70 2005/12/29 15:32:11 roberto Exp $ +** $Id: liolib.c,v 2.71 2006/01/17 13:54:02 roberto Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -28,6 +28,7 @@ static const char *const fnames[] = {"input", "output"}; static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ if (i) { lua_pushboolean(L, 1); return 1; @@ -35,10 +36,10 @@ static int pushresult (lua_State *L, int i, const char *filename) { else { lua_pushnil(L); if (filename) - lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); else - lua_pushfstring(L, "%s", strerror(errno)); - lua_pushinteger(L, errno); + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); return 3; } } |