From: cras Date: Sat, 24 Aug 2002 12:15:25 +0000 (+0000) Subject: silc_rng_exec_command() left zombie processes if command didn't generate any X-Git-Tag: silc.client.0.9.5~22 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=3b65e62e6cbb033a5936ddf19df5333fbe13791a silc_rng_exec_command() left zombie processes if command didn't generate any output. --- diff --git a/CHANGES b/CHANGES index b19e51dd..49296c2a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Sat Aug 24 15:11:32 EEST 2002 Timo Sirainen + + * silc_rng_exec_command() left zombie processes if command + didn't generate any output. + Fri Aug 23 22:05:44 CEST 2002 Lubomir Sedlacik * Rewrote iconv checking, introduce --with-iconv for systems diff --git a/lib/silccrypt/silcrng.c b/lib/silccrypt/silcrng.c index a97773d3..f8274211 100644 --- a/lib/silccrypt/silcrng.c +++ b/lib/silccrypt/silcrng.c @@ -351,19 +351,18 @@ static void silc_rng_exec_command(SilcRng rng, char *command) /* Get data as much as we can get into the buffer */ for (i = 0; i < sizeof(buf); i++) { c = fgetc(fd); - if (c == EOF) { - if (!i) - return; + if (c == EOF) break; - } buf[i] = c; } pclose(fd); - /* Add the buffer into random pool */ - silc_rng_add_noise(rng, buf, i); - memset(buf, 0, sizeof(buf)); + if (i != 0) { + /* Add the buffer into random pool */ + silc_rng_add_noise(rng, buf, i); + memset(buf, 0, sizeof(buf)); + } #endif }