summaryrefslogtreecommitdiff
path: root/time/sunbird/patches/patch-af
blob: ccb38695192a8089a3be58beb5694b46c8679ebe (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
$NetBSD: patch-af,v 1.3 2006/10/12 13:42:34 ghen Exp $

--- security/nss/lib/freebl/unix_rand.c.orig	2006-04-04 01:01:51.000000000 +0000
+++ security/nss/lib/freebl/unix_rand.c
@@ -35,6 +35,7 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include <stdio.h>
+#include <fcntl.h>
 #include <string.h>
 #include <signal.h>
 #include <unistd.h>
@@ -183,7 +183,8 @@ static SECStatus RNG_kstat(PRUint32* fed
 #endif
 
 #if defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(FREEBSD) \
-    || defined(NETBSD) || defined(NTO) || defined(DARWIN) || defined(OPENBSD)
+    || defined(NETBSD) || defined(NTO) || defined(DARWIN) || defined(OPENBSD) \
+    || defined(DRAGONFLY)
 #include <sys/times.h>
 
 #define getdtablesize() sysconf(_SC_OPEN_MAX)
@@ -694,7 +696,11 @@ safe_popen(char *cmd)
 	/* dup write-side of pipe to stderr and stdout */
 	if (p[1] != 1) dup2(p[1], 1);
 	if (p[1] != 2) dup2(p[1], 2);
-	close(0);
+	fd = open("/dev/null", O_RDONLY);
+	if (fd != 0) {
+	    dup2(fd, 0);
+	    close(fd);
+	}
         {
             int ndesc = getdtablesize();
             for (fd = PR_MIN(65536, ndesc); --fd > 2; close(fd));