aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/loslib.c b/loslib.c
index 728ee1d8..034acd5f 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loslib.c,v 1.5 2005/03/08 20:10:05 roberto Exp roberto $ 2** $Id: loslib.c,v 1.6 2005/03/09 16:28:07 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*/
@@ -57,16 +57,13 @@ static int io_rename (lua_State *L) {
57 57
58 58
59static int io_tmpname (lua_State *L) { 59static int io_tmpname (lua_State *L) {
60#if !LUA_USE_TMPNAME 60 char buff[LUA_TMPNAMBUFSIZE];
61 luaL_error(L, "`tmpname' not supported"); 61 int err;
62 return 0; 62 lua_tmpnam(buff, err);
63#else 63 if (err)
64 char buff[L_tmpnam]; 64 return luaL_error(L, "unable to generate a unique filename");
65 if (tmpnam(buff) != buff)
66 return luaL_error(L, "unable to generate a unique filename in `tmpname'");
67 lua_pushstring(L, buff); 65 lua_pushstring(L, buff);
68 return 1; 66 return 1;
69#endif
70} 67}
71 68
72 69