use mkstemp().

This commit is contained in:
kevlo 2004-02-06 08:29:24 +00:00
parent c935cffa6a
commit e7f0b7d4d6

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-fileio_c,v 1.1 2004/02/06 08:29:24 kevlo Exp $
--- fileio.c.orig 2004-02-06 16:11:15.000000000 +0000
+++ fileio.c 2004-02-06 16:21:58.000000000 +0000
@@ -859,7 +859,15 @@ char *zip; /* path name of
}
#else
strcat(t, "ziXXXXXX"); /* must use lowercase for Linux dos file system */
- return mktemp(t);
+ {
+ int fd = mkstemp(t);
+ if ( fd == -1 ) {
+ perror( "can't create temp file" );
+ exit(1);
+ }
+ close(fd);
+ return t;
+ }
#endif /* NO_MKTEMP */
#endif /* TANDEM */
#endif /* CMS_MVS */