mkstemp check is there, use it

This commit is contained in:
tg 2004-04-07 17:24:40 +00:00
parent 85a77b6191
commit 95ae34eb0c

8
io.c
View File

@ -1,4 +1,4 @@
/* $MirBSD: io.c,v 1.2 2004/04/07 17:14:12 tg Exp $ */ /* $MirBSD: io.c,v 1.3 2004/04/07 17:24:40 tg Exp $ */
/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */ /* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */
/* /*
@ -506,7 +506,7 @@ maketemp(ap, type, tlist)
Temp_type type; Temp_type type;
struct temp **tlist; struct temp **tlist;
{ {
#ifdef NO_MKSTEMP #ifndef HAVE_MKSTEMP
static unsigned int inc; static unsigned int inc;
#endif #endif
struct temp *tp; struct temp *tp;
@ -522,7 +522,7 @@ maketemp(ap, type, tlist)
tp->name = path = (char *) &tp[1]; tp->name = path = (char *) &tp[1];
tp->shf = (struct shf *) 0; tp->shf = (struct shf *) 0;
tp->type = type; tp->type = type;
#ifndef NO_MKSTEMP #ifdef HAVE_MKSTEMP
shf_snprintf(path, len, "%s/shXXXXXXXX", dir); shf_snprintf(path, len, "%s/shXXXXXXXX", dir);
fd = mkstemp(path); fd = mkstemp(path);
if (fd >= 0) if (fd >= 0)
@ -553,7 +553,7 @@ maketemp(ap, type, tlist)
*/ */
break; break;
} }
#endif /* !ndef NO_MKSTEMP */ #endif /* !def HAVE_MKSTEMP */
tp->pid = procpid; tp->pid = procpid;
tp->next = *tlist; tp->next = *tlist;