summaryrefslogtreecommitdiff
path: root/entropy.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-04-18 22:53:22 +1000
committerDamien Miller <djm@mindrot.org>2002-04-18 22:53:22 +1000
commita370f4dcc6ae04c430ad97c28a2bd945c2350120 (patch)
tree0a91032abb9d8f5bd93cd4884793aeb7cf4863d5 /entropy.c
parent43a1c13e0fd522cf31666931b66891d23bb3de6d (diff)
- (djm) Avoid SIGCHLD breakage when run from rsync. Fix from
Sturle Sunde <sturle.sunde@usit.uio.no>
Diffstat (limited to 'entropy.c')
-rw-r--r--entropy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/entropy.c b/entropy.c
index 8f6ab0ea0..84c15eb76 100644
--- a/entropy.c
+++ b/entropy.c
@@ -45,7 +45,7 @@
45 * XXX: we should tell the child how many bytes we need. 45 * XXX: we should tell the child how many bytes we need.
46 */ 46 */
47 47
48RCSID("$Id: entropy.c,v 1.41 2002/03/11 00:16:35 stevesk Exp $"); 48RCSID("$Id: entropy.c,v 1.42 2002/04/18 12:53:27 djm Exp $");
49 49
50#ifndef OPENSSL_PRNG_ONLY 50#ifndef OPENSSL_PRNG_ONLY
51#define RANDOM_SEED_SIZE 48 51#define RANDOM_SEED_SIZE 48
@@ -61,6 +61,7 @@ seed_rng(void)
61 pid_t pid; 61 pid_t pid;
62 int ret; 62 int ret;
63 unsigned char buf[RANDOM_SEED_SIZE]; 63 unsigned char buf[RANDOM_SEED_SIZE];
64 mysig_t old_sigchld;
64 65
65 if (RAND_status() == 1) { 66 if (RAND_status() == 1) {
66 debug3("RNG is ready, skipping seeding"); 67 debug3("RNG is ready, skipping seeding");
@@ -74,6 +75,7 @@ seed_rng(void)
74 if (pipe(p) == -1) 75 if (pipe(p) == -1)
75 fatal("pipe: %s", strerror(errno)); 76 fatal("pipe: %s", strerror(errno));
76 77
78 old_sigchld = mysignal(SIGCHLD, SIG_DFL);
77 if ((pid = fork()) == -1) 79 if ((pid = fork()) == -1)
78 fatal("Couldn't fork: %s", strerror(errno)); 80 fatal("Couldn't fork: %s", strerror(errno));
79 if (pid == 0) { 81 if (pid == 0) {
@@ -113,6 +115,7 @@ seed_rng(void)
113 if (waitpid(pid, &ret, 0) == -1) 115 if (waitpid(pid, &ret, 0) == -1)
114 fatal("Couldn't wait for ssh-rand-helper completion: %s", 116 fatal("Couldn't wait for ssh-rand-helper completion: %s",
115 strerror(errno)); 117 strerror(errno));
118 mysignal(SIGCHLD, old_sigchld);
116 119
117 /* We don't mind if the child exits upon a SIGPIPE */ 120 /* We don't mind if the child exits upon a SIGPIPE */
118 if (!WIFEXITED(ret) && 121 if (!WIFEXITED(ret) &&