summaryrefslogtreecommitdiffstats
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 8f6ab0ea..84c15eb7 100644
--- a/entropy.c
+++ b/entropy.c
@@ -45,7 +45,7 @@
* XXX: we should tell the child how many bytes we need.
*/
-RCSID("$Id: entropy.c,v 1.41 2002/03/11 00:16:35 stevesk Exp $");
+RCSID("$Id: entropy.c,v 1.42 2002/04/18 12:53:27 djm Exp $");
#ifndef OPENSSL_PRNG_ONLY
#define RANDOM_SEED_SIZE 48
@@ -61,6 +61,7 @@ seed_rng(void)
pid_t pid;
int ret;
unsigned char buf[RANDOM_SEED_SIZE];
+ mysig_t old_sigchld;
if (RAND_status() == 1) {
debug3("RNG is ready, skipping seeding");
@@ -74,6 +75,7 @@ seed_rng(void)
if (pipe(p) == -1)
fatal("pipe: %s", strerror(errno));
+ old_sigchld = mysignal(SIGCHLD, SIG_DFL);
if ((pid = fork()) == -1)
fatal("Couldn't fork: %s", strerror(errno));
if (pid == 0) {
@@ -113,6 +115,7 @@ seed_rng(void)
if (waitpid(pid, &ret, 0) == -1)
fatal("Couldn't wait for ssh-rand-helper completion: %s",
strerror(errno));
+ mysignal(SIGCHLD, old_sigchld);
/* We don't mind if the child exits upon a SIGPIPE */
if (!WIFEXITED(ret) &&