mirror of https://github.com/lua/lua
template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE)
This commit is contained in:
parent
68616c6669
commit
a0d4f0fc8a
10
loslib.c
10
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); }
|
||||
|
|
Loading…
Reference in New Issue