diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-29 14:05:13 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-29 14:05:13 -0300 |
commit | a0d4f0fc8aba2bb0a3ba6f49f2a0f1153e4435ba (patch) | |
tree | b67592ade745c304eb3a065807efaa78a9ea3a89 /loslib.c | |
parent | 68616c6669f6029d96cb9c683f81d652274d4df2 (diff) | |
download | lua-a0d4f0fc8aba2bb0a3ba6f49f2a0f1153e4435ba.tar.gz lua-a0d4f0fc8aba2bb0a3ba6f49f2a0f1153e4435ba.tar.bz2 lua-a0d4f0fc8aba2bb0a3ba6f49f2a0f1153e4435ba.zip |
template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE)
Diffstat (limited to 'loslib.c')
-rw-r--r-- | loslib.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.44 2014/03/12 20:57:40 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.45 2014/03/20 19:18:54 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 | */ |
@@ -59,9 +59,15 @@ | |||
59 | #if defined(LUA_USE_POSIX) /* { */ | 59 | #if defined(LUA_USE_POSIX) /* { */ |
60 | 60 | ||
61 | #include <unistd.h> | 61 | #include <unistd.h> |
62 | |||
62 | #define LUA_TMPNAMBUFSIZE 32 | 63 | #define LUA_TMPNAMBUFSIZE 32 |
64 | |||
65 | #if !defined(LUA_TMPNAMTEMPLATE) | ||
66 | #define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" | ||
67 | #endif | ||
68 | |||
63 | #define lua_tmpnam(b,e) { \ | 69 | #define lua_tmpnam(b,e) { \ |
64 | strcpy(b, "/tmp/lua_XXXXXX"); \ | 70 | strcpy(b, LUA_TMPNAMTEMPLATE); \ |
65 | e = mkstemp(b); \ | 71 | e = mkstemp(b); \ |
66 | if (e != -1) close(e); \ | 72 | if (e != -1) close(e); \ |
67 | e = (e == -1); } | 73 | e = (e == -1); } |