1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
$NetBSD: patch-ac,v 1.1.1.1 2001/10/02 13:15:56 wiz Exp $
--- mapit.c.orig Fri Mar 13 20:38:03 1998
+++ mapit.c
@@ -229,6 +229,7 @@
char *p0,*p1; /* and character pointers */
int started; /* is a map already started? */
int report; /* type of report */
+ int fd; /* file descriptor for output file */
extern char *optarg; /* used by getopt() */
extern int optind;
@@ -318,8 +319,8 @@
}
if (new_borders) { /* We'll need a temporary file */
- tmpnam(tempfilename);
- if(!(nstdout = fopen(tempfilename, "w")))
+ fd=mkstemp(tempfilename);
+ if(fd == -1 || !(nstdout = fdopen(fd, "w")))
fprintf(stderr, "Unable to open file..\n");
}
@@ -511,7 +512,7 @@
else
ownerlist[i+1] = ownerlist[i];
- if(!(nstdout = fopen(tempfilename, "r")))
+ if(!(nstdout = fdopen(fd, "r")))
fprintf(stderr,"Unable to reopen file.\n");
else {
while(fgets(line, BUFSIZ, nstdout))
|