blob: 7f086795fae3a12105b249bce2e83e097d65d227 (
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
|
$NetBSD: patch-ao,v 1.1 2007/05/13 16:59:40 taca Exp $
--- zoopack.c.orig 1993-05-01 12:59:21.000000000 +0900
+++ zoopack.c
@@ -32,7 +32,9 @@ Copyright (C) 1986, 1987 Rahul Dhesi --
#include <signal.h>
#endif
+#ifdef USE_MKTEMP
char *mktemp PARMS((char *));
+#endif
struct zoo_header zoo_header = {
TEXT,
@@ -76,6 +78,7 @@ int bad_header = 0;
int latest_date = 0; /* latest date on any file moved */
int latest_time = 0; /* ...likewise */
int curr_dir = 0; /* create backup in curr dir */
+static int fd;
static char partial_msg[] =
"Partially packed archive left in %s.\n";
@@ -171,9 +174,16 @@ if (!curr_dir) {
} else {
strcpy (temp_file, xes);
}
+#ifdef USE_MKTEMP
+fd = 0;
mktemp (temp_file); /* ... and make unique */
new_file = zoocreate (temp_file);
-if (new_file == NOFILE)
+#else
+fd = mkstemp (temp_file);
+if (fd >= 0)
+ new_file = zoocreate (temp_file);
+#endif
+if (fd < 0 || new_file == NOFILE)
prterror ('f', "Could not create temporary file %s.\n", temp_file);
/*
|