mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-12 07:27:57 +00:00
Fix a bug in my own tmpnam() --> mkstemp() patch.
Reported by: Pascal Hofstee <daeron@shadowmere.student.utwente.nl>
This commit is contained in:
parent
102dab4463
commit
e7d1d4a4a9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=29547
@ -1,21 +1,30 @@
|
||||
--- filehandling.c.orig Tue Feb 15 03:03:56 2000
|
||||
+++ filehandling.c Wed Jun 7 01:03:50 2000
|
||||
@@ -464,6 +464,7 @@
|
||||
+++ filehandling.c Mon Jun 12 19:07:56 2000
|
||||
@@ -458,13 +458,18 @@
|
||||
FILE *theFile;
|
||||
int c;
|
||||
char *desc = NULL;
|
||||
+ int fd;
|
||||
|
||||
theRealFileName = PLGetString(PLGetFilename(pl));
|
||||
if(!theRealFileName) return NO;
|
||||
|
||||
if (atomically)
|
||||
{
|
||||
+#ifndef HAVE_MKSTEMP
|
||||
theFileName = tmpnam(NULL);
|
||||
+#else
|
||||
+ theFileName = "/var/tmp/tmp.XXXXXX";
|
||||
+#endif
|
||||
strcpy(tmp_fileName, theFileName);
|
||||
|
||||
@@ -492,14 +493,33 @@
|
||||
if((tmp_basename=strtok(tmp_fileName, "/")))
|
||||
@@ -492,14 +497,31 @@
|
||||
}
|
||||
|
||||
theFileName = strcat(dirname, basename);
|
||||
+#else /* HAVE_MKSTEMP */
|
||||
+ int fd;
|
||||
+
|
||||
+ strcpy(tmp_fileName, "/tmp/tmp.XXXXXX");
|
||||
+#ifdef HAVE_MKSTEMP
|
||||
+ strcpy(tmp_fileName, theFileName);
|
||||
+ if ((fd = mkstemp(tmp_fileName)) == -1)
|
||||
+
|
||||
+ goto failure; /* Not reached */
|
||||
|
Loading…
Reference in New Issue
Block a user