lua

A copy of the Lua development repository
Log | Files | Refs | README

commit a0d4f0fc8aba2bb0a3ba6f49f2a0f1153e4435ba
parent 68616c6669f6029d96cb9c683f81d652274d4df2
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 29 Apr 2014 14:04:48 -0300

template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE)

Diffstat:
Mloslib.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/loslib.c b/loslib.c @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.44 2014/03/12 20:57:40 roberto Exp roberto $ +** $Id: loslib.c,v 1.45 2014/03/20 19:18:54 roberto Exp roberto $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -59,9 +59,15 @@ #if defined(LUA_USE_POSIX) /* { */ #include <unistd.h> + #define LUA_TMPNAMBUFSIZE 32 + +#if !defined(LUA_TMPNAMTEMPLATE) +#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" +#endif + #define lua_tmpnam(b,e) { \ - strcpy(b, "/tmp/lua_XXXXXX"); \ + strcpy(b, LUA_TMPNAMTEMPLATE); \ e = mkstemp(b); \ if (e != -1) close(e); \ e = (e == -1); }