Index: unix_rand.c =================================================================== RCS file: /cvsroot/mozilla/security/nss/lib/freebl/unix_rand.c,v retrieving revision 1.22 diff -u -r1.22 unix_rand.c --- unix_rand.c 12 Oct 2006 22:48:19 -0000 1.22 +++ unix_rand.c 6 Jan 2007 01:16:33 -0000 @@ -775,6 +775,13 @@ if (pipe(p) < 0) return 0; + fp = fdopen(p[0], "r"); + if (fp == 0) { + close(p[0]); + close(p[1]); + return 0; + } + /* Setup signals so that SIGCHLD is ignored as we want to do waitpid */ newact.sa_handler = SIG_DFL; newact.sa_flags = 0; @@ -784,7 +791,7 @@ pid = fork(); switch (pid) { case -1: - close(p[0]); + fclose(fp); /* this closes p[0], the fd associated with fp */ close(p[1]); sigaction (SIGCHLD, &oldact, NULL); return 0; @@ -826,12 +833,6 @@ default: close(p[1]); - fp = fdopen(p[0], "r"); - if (fp == 0) { - close(p[0]); - sigaction (SIGCHLD, &oldact, NULL); - return 0; - } break; }