summaryrefslogtreecommitdiff
path: root/graphics/xpaint/patches/patch-ad
blob: 20b7ae5e06529fda708bf4f84be64b66a01624bd (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
$NetBSD: patch-ad,v 1.6 2002/12/16 09:29:13 tron Exp $

--- readRC.c.orig	Sun Nov 24 15:53:30 2002
+++ readRC.c	Sun Dec 15 18:58:00 2002
@@ -75,6 +75,10 @@
 static FILE *
 openTemp(char **np)
 {
+#ifdef __NetBSD__
+    int	fd;
+    FILE *f;
+#endif
     char *n;
     char xx[256];
 
@@ -83,11 +87,23 @@
 
     strcpy(xx, n);
     strcat(xx, "/XPaint-XXXXXX");
+#ifdef __NetBSD__
+    if ((fd = mkstemp(xx)) < 0)
+           return NULL;
+    tempName[++tempIndex] = XtNewString(xx);
+    if (np != NULL)
+       *np = tempName[tempIndex];
+    f = fdopen(fd, "w");
+    if (f == NULL)
+       (void) close(fd);
+    return f;
+#else
     n = mktemp(xx);
     tempName[++tempIndex] = XtNewString(n);
     if (np != NULL)
         *np = tempName[tempIndex];
     return fopen(tempName[tempIndex], "w");
+#endif
 }
 
 static void