summaryrefslogtreecommitdiff
path: root/converters/mpack/patches/patch-ae
blob: bbba1fa6ef07ac3d6e8c01e44ea618fc7224be61 (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
42
43
44
$NetBSD: patch-ae,v 1.4 2010/04/20 10:26:40 is Exp $

--- unixpk.c.orig	2003-07-21 22:50:41.000000000 +0200
+++ unixpk.c
@@ -22,8 +22,16 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  * SOFTWARE.
  */
+
+#ifdef __NetBSD__
+/* Use of mktemp() below is ok - resulting names are opened with O_EXCL. */
+#define __MKTEMP_OK__
+#endif
+
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include "common.h"
 #include "version.h"
@@ -31,9 +39,6 @@
 
 #define MAXADDRESS 100
 
-extern char *getenv();
-
-extern int errno;
 extern int optind;
 extern char *optarg;
 
@@ -164,7 +169,11 @@ int main(int argc, char **argv)
 	    strcpy(fnamebuf, getenv("TMPDIR"));
 	}
 	else {
-	    strcpy(fnamebuf, "/usr/tmp");
+#if defined(P_tmpdir)
+	    strcpy(fnamebuf, P_tmpdir);
+#else
+	    strcpy(fnamebuf, "/var/tmp");
+#endif
 	}
 	strcat(fnamebuf, "/mpackXXXXXX");
 	mktemp(fnamebuf);