Files
2013-09-26 17:14:40 +02:00

42 lines
1.1 KiB
Plaintext

$NetBSD: patch-ae,v 1.2 2005/12/05 20:50:58 rillig Exp $
--- src/config.parse.c.orig 1994-07-20 18:03:26.000000000 -0700
+++ src/config.parse.c
@@ -55,7 +55,6 @@
#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);