mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Improve tmpfile api (#114)
This commit is contained in:
parent
2bd1e72d5a
commit
816b0e1851
3 changed files with 56 additions and 8 deletions
8
third_party/lua/loslib.c
vendored
8
third_party/lua/loslib.c
vendored
|
@ -10,6 +10,7 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/temp.h"
|
||||
#include "libc/sysv/consts/exit.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
|
@ -114,12 +115,9 @@
|
|||
|
||||
#define LUA_TMPNAMBUFSIZE 32
|
||||
|
||||
#if !defined(LUA_TMPNAMTEMPLATE)
|
||||
#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX"
|
||||
#endif
|
||||
|
||||
#define lua_tmpnam(b,e) { \
|
||||
strcpy(b, LUA_TMPNAMTEMPLATE); \
|
||||
strcpy(b, kTmpPath); \
|
||||
strcat(b, "lua_XXXXXX"); \
|
||||
e = mkstemp(b); \
|
||||
if (e != -1) close(e); \
|
||||
e = (e == -1); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue