Browse Source

template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE)

Roberto Ierusalimschy 11 years ago
parent
commit
a0d4f0fc8a
1 changed files with 8 additions and 2 deletions
  1. 8 2
      loslib.c

+ 8 - 2
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
 ** Standard Operating System library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -59,9 +59,15 @@
 #if defined(LUA_USE_POSIX)	/* { */
 #if defined(LUA_USE_POSIX)	/* { */
 
 
 #include <unistd.h>
 #include <unistd.h>
+
 #define LUA_TMPNAMBUFSIZE	32
 #define LUA_TMPNAMBUFSIZE	32
+
+#if !defined(LUA_TMPNAMTEMPLATE)
+#define LUA_TMPNAMTEMPLATE	"/tmp/lua_XXXXXX"
+#endif
+
 #define lua_tmpnam(b,e) { \
 #define lua_tmpnam(b,e) { \
-        strcpy(b, "/tmp/lua_XXXXXX"); \
+        strcpy(b, LUA_TMPNAMTEMPLATE); \
         e = mkstemp(b); \
         e = mkstemp(b); \
         if (e != -1) close(e); \
         if (e != -1) close(e); \
         e = (e == -1); }
         e = (e == -1); }