use mktemp instead of tmpname

This commit is contained in:
Vítor Santos Costa 2014-05-25 10:21:28 +01:00
parent 8e798db830
commit 279a057d80

View File

@ -140,7 +140,7 @@
#endif #endif
#endif #endif
void PROTO(init_sys, (void)); void init_sys(void);
#if defined(__MINGW32__) || _MSC_VER #if defined(__MINGW32__) || _MSC_VER
static YAP_Term static YAP_Term
@ -494,7 +494,12 @@ p_mktemp(void)
static int static int
p_tmpnam(void) p_tmpnam(void)
{ {
#if HAVE_TMPNAM #if HAVE_MKTEMP
char *s;
if (!(s = mktemp("/tmp/YAP_tmpXXXXXXXX")))
return FALSE;
return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(s)));
#elif HAVE_TMPNAM
char buf[L_tmpnam], *s; char buf[L_tmpnam], *s;
if (!(s = tmpnam(buf))) if (!(s = tmpnam(buf)))
return FALSE; return FALSE;