]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Reported by Tim Kosse: on Unix, read_random_seed() wasn't correctly checking
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 26 Apr 2009 22:32:41 +0000 (22:32 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 26 Apr 2009 22:32:41 +0000 (22:32 +0000)
the return from open() and behaved wrongly in the absence of a seed file.

[originally from svn r8517]

unix/uxstore.c

index 9d767266dcaeca192afe58889ce44e4e0106163d..2476e4edf5e88d0b364052763d3f78d1a5293519 100644 (file)
@@ -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)