From: Jacob Nevins Date: Sun, 26 Apr 2009 22:32:41 +0000 (+0000) Subject: Reported by Tim Kosse: on Unix, read_random_seed() wasn't correctly checking X-Git-Tag: 0.61~150 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;ds=inline;h=542fc983bbbaa674007669b3ae99967c852c1ebf;p=PuTTY.git Reported by Tim Kosse: on Unix, read_random_seed() wasn't correctly checking the return from open() and behaved wrongly in the absence of a seed file. [originally from svn r8517] --- diff --git a/unix/uxstore.c b/unix/uxstore.c index 9d767266..2476e4ed 100644 --- a/unix/uxstore.c +++ b/unix/uxstore.c @@ -638,7 +638,7 @@ void read_random_seed(noise_consumer_t consumer) fname = make_filename(INDEX_RANDSEED, NULL); fd = open(fname, O_RDONLY); sfree(fname); - if (fd) { + if (fd >= 0) { char buf[512]; int ret; while ( (ret = read(fd, buf, sizeof(buf))) > 0)