use mkstemp.

This commit is contained in:
mrg 1999-04-20 08:05:51 +00:00
parent c08b0cf381
commit 7ef0b55f16
2 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: eval.c,v 1.10 1997/10/19 04:39:51 lukem Exp $ */
/* $NetBSD: eval.c,v 1.11 1999/04/20 08:05:51 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: eval.c,v 1.10 1997/10/19 04:39:51 lukem Exp $");
__RCSID("$NetBSD: eval.c,v 1.11 1999/04/20 08:05:51 mrg Exp $");
#endif
#endif /* not lint */
@ -296,8 +296,15 @@ eval(argv, argc, td)
/*
* dotemp - create a temporary file
*/
if (argc > 2)
pbstr(mktemp(argv[2]));
if (argc > 2) {
int fd;
fd = mkstemp(argv[2]);
if (fd == -1)
err(1, "mkstemp failed");
close(fd);
pbstr(argv[2]);
}
break;
case TRNLTYPE:

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.20 1998/12/19 19:54:26 christos Exp $ */
/* $NetBSD: main.c,v 1.21 1999/04/20 08:05:52 mrg Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: main.c,v 1.20 1998/12/19 19:54:26 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.21 1999/04/20 08:05:52 mrg Exp $");
#endif
#endif /* not lint */
@ -157,6 +157,7 @@ main(argc,argv)
{
int c;
int n;
int fd;
char *p;
FILE *ifp;
@ -191,7 +192,11 @@ main(argc,argv)
active = stdout; /* default active output */
/* filename for diversions */
m4temp = mktemp(xstrdup(_PATH_DIVNAME));
m4temp = xstrdup(_PATH_DIVNAME);
fd = mkstemp(m4temp);
if (fd == -1)
err(1, "mkstemp failed");
close(fd);
bbase[0] = bufbase;
if (!argc) {