Reported by Tim Kosse: on Unix, read_random_seed() wasn't correctly checking
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 26 Apr 2009 22:32:41 +0000 (22:32 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@8517 cda61777-01e9-0310-a592-d414129be87e

unix/uxstore.c

index 9d76726..2476e4e 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)