summaryrefslogtreecommitdiff
path: root/security/tripwire/patches/patch-ae
blob: 6f91bcdfd901b911277c47c30a6530ed8b781bc3 (plain)
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
33
34
35
36
37
38
39
40
41
$NetBSD: patch-ae,v 1.1 2003/12/05 05:40:32 ben Exp $

--- src/config.parse.c.orig	1994-07-20 18:03:26.000000000 -0700
+++ src/config.parse.c
@@ -55,7 +55,6 @@ static char rcsid[] = "$Id: config.parse
 #endif
 
 /* prototypes */
-char *mktemp();
 static void configfile_descend();
 
 #ifndef L_tmpnam
@@ -90,6 +89,7 @@ configfile_read(pp_list, pp_entry_list)
     char	number[128];
     int		entrynum = 0;
     int		err;
+    int		fdout;
 
     /* to make code semi-reentrant */
     list_reset(&prune_list);
@@ -105,8 +105,9 @@ configfile_read(pp_list, pp_entry_list)
     };
     (void) strcpy(tmpfilename, TEMPFILE_TEMPLATE);
 
-    if ((char *) mktemp(tmpfilename) == NULL) {
-	perror("configfile_read: mktemp()");
+    fdout = mkstemp(tmpfilename);
+    if (fdout == -1) {
+	perror("configfile_read: mkstemp()");
 	exit(1);
     }
 
@@ -149,7 +150,7 @@ configfile_read(pp_list, pp_entry_list)
 
     err = umask(077);  /* to protect the tempfile */
 
-    if ((fpout = fopen(tmpfilename, "w+")) == NULL) {
+    if ((fpout = fdopen(fdout, "w+")) == NULL) {
 	sprintf(s, "tripwire: Couldn't open config file '%s'", configfile);
 	perror(s);
 	exit(1);