summaryrefslogtreecommitdiff
path: root/mail/ja-mh/patches/patch-bz
blob: 0afc8408d0d63ddd3430cf50297c8889d590c283 (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-bz,v 1.1 2010/09/27 12:01:49 taca Exp $

* Change m_tmpfil to avoid to use mktemp(3).

--- uip/distsbr.c.orig	1993-12-01 04:01:35.000000000 +0000
+++ uip/distsbr.c
@@ -150,15 +150,10 @@ register char   *msgnam;
 
     if ((ifp = fopen (msgnam, "r")) == NULL)
 	adios (msgnam, "unable to open message");
-
-    (void) strcpy (tmpfil, m_tmpfil ("dist"));
-    if ((hdrfd = creat (tmpfil, 0600)) == NOTOK)
-	adios (tmpfil, "unable to create temporary file");
-    (void) close (hdrfd);
-    if ((hdrfd = open (tmpfil, 2)) == NOTOK)
-	adios (tmpfil, "unable to re-open temporary file");
+    
+    (void) strcpy (tmpfil, m_tmpfil("dist", &hdrfd));
     if ((out = dup (hdrfd)) == NOTOK
-	    || (ofp = fdopen (out, "w")) == NULL)
+	   || (ofp = fdopen (out, "w")) == NULL)
 	adios (NULLCP, "no file descriptors -- you lose big");
     (void) unlink (tmpfil);
 
@@ -186,12 +181,7 @@ register char   *msgnam;
 	    case BODYEOF: 
 		(void) fclose (ofp);
 
-		(void) strcpy (tmpfil, m_tmpfil ("dist"));
-		if ((txtfd = creat (tmpfil, 0600)) == NOTOK)
-		    adios (tmpfil, "unable to create temporary file");
-		(void) close (txtfd);
-		if ((txtfd = open (tmpfil, 2)) == NOTOK)
-		    adios (tmpfil, "unable to re-open temporary file");
+		(void) strcpy (tmpfil, m_tmpfil("dist", &txtfd));
 		if ((out = dup (txtfd)) == NOTOK
 			|| (ofp = fdopen (out, "w")) == NULL)
 		    adios (NULLCP, "no file descriptors -- you lose big");