summaryrefslogtreecommitdiff
path: root/www/wml/patches/patch-al
blob: edb866ce6e2a0bb9e0e07ecc2ad8548d7d89345f (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
$NetBSD: patch-al,v 1.2 2008/08/12 20:09:34 tonnerre Exp $

--- wml_backend/p3_eperl/eperl_sys.c.orig	2002-08-08 23:56:26.000000000 +0200
+++ wml_backend/p3_eperl/eperl_sys.c
@@ -211,13 +211,20 @@ char *mytmpfile(char *id)
 {
     char ca[1024];
     char *cp, *tmpdir;
+    char tmpfile[]="eperl_sourceXXXXXX";
     int i;
+    int fd=-1;
 
     tmpdir = getenv ("TMPDIR");
     if (tmpdir == (char *) NULL)
         tmpdir="/tmp";
 
-    snprintf(ca, sizeof(ca), "%s/%s.%d.tmp%d", tmpdir, id, (int)getpid(), mytmpfilecnt++);
+    snprintf(ca, sizeof(ca), "%s/%s", tmpdir, tmpfile);
+    if((fd = mkstemp(tmpfile)) == -1){
+        perror("can not create tmpfile");
+        return NULL;
+    }
+    close(fd);
     ca[sizeof(ca)-1] = NUL;
     cp = strdup(ca);
     for (i = 0; mytmpfiles[i] != NULL; i++)