summaryrefslogtreecommitdiff
path: root/net-mgmt/arpwatch/files/patch-ad
blob: 02096d9d63bf00d0c6a1179ef23b5100323c3bfd (plain) (blame)
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
--- report.c.orig	Fri Jun  9 09:54:48 2000
+++ report.c	Fri Jun  9 10:05:58 2000
@@ -249,6 +249,9 @@
 	char *unknown = "<unknown>";
 	char buf[132];
 	static int init = 0;
+#ifdef HAVE_MKSTEMP
+	int fd;
+#endif
 
 	/* No report until we're initialized */
 	if (initializing)
@@ -286,8 +289,16 @@
 		/* Child */
 		closelog();
 		(void)strcpy(tempfile, "/tmp/arpwatch.XXXXXX");
+#ifndef HAVE_MKSTEMP
 		(void)mktemp(tempfile);
 		if ((f = fopen(tempfile, "w+")) == NULL) {
+#else
+		if ((fd = mkstemp(tempfile)) == -1) {
+			syslog(LOG_ERR, "child mkstemp(%s): %m", tempfile);
+			exit(1);
+		}
+		if ((f = fdopen(fd, "w+")) == NULL) {
+#endif /* HAVE_MKSTEMP */
 			syslog(LOG_ERR, "child open(%s): %m", tempfile);
 			exit(1);
 		}