48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
|
$OpenBSD: patch-Src_util_c,v 1.1.1.1 2001/07/04 15:22:34 lebel Exp $
|
||
|
--- Src/util.c.orig Tue Jan 19 03:29:19 1999
|
||
|
+++ Src/util.c Mon Jun 18 11:01:24 2001
|
||
|
@@ -177,6 +177,7 @@ tempfile (char *rootname)
|
||
|
{
|
||
|
char tmp[256];
|
||
|
FILE *f;
|
||
|
+ int fptr;
|
||
|
|
||
|
#ifdef SHORTNAMES
|
||
|
if (strlen (rootname) > 2)
|
||
|
@@ -184,8 +185,11 @@ tempfile (char *rootname)
|
||
|
#endif
|
||
|
sprintf (tmp, "%sXXXXXX", rootname);
|
||
|
strcpy (rootname, tmp);
|
||
|
- if (!mktemp (rootname))
|
||
|
- return (NULL);
|
||
|
+ fptr = mkstemp(rootname);
|
||
|
+ if (fptr > 0)
|
||
|
+ close(fptr);
|
||
|
+ else
|
||
|
+ exit(-1);
|
||
|
f = open_mix_file (rootname, "w+");
|
||
|
if (f == NULL)
|
||
|
exit (-1); /* we are in deep trouble and may as well exit */
|
||
|
@@ -202,6 +206,7 @@ tempfileb (char *rootname)
|
||
|
{
|
||
|
char tmp[256];
|
||
|
FILE *f;
|
||
|
+ int fptr;
|
||
|
|
||
|
#ifdef SHORTNAMES
|
||
|
if (strlen (rootname) > 2)
|
||
|
@@ -209,8 +214,11 @@ tempfileb (char *rootname)
|
||
|
#endif
|
||
|
sprintf (tmp, "%sXXXXXX", rootname);
|
||
|
strcpy (rootname, tmp);
|
||
|
- if (!mktemp (rootname))
|
||
|
- return (NULL);
|
||
|
+ fptr = mkstemp(rootname);
|
||
|
+ if (fptr > 0)
|
||
|
+ close(fptr);
|
||
|
+ else
|
||
|
+ exit(-1);
|
||
|
f = open_mix_file (rootname, "wb+");
|
||
|
if (f == NULL)
|
||
|
exit (-1); /* we are in deep trouble and may as well exit */
|