From cf49b6fe8714000f94f486c032e6b2f560ccace1 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 29 Jan 2019 15:27:22 -0800 Subject: [PATCH] last warning fix Compiler gave four diagnostics about 'seed' being used uninitialized if 'no_seed' were false, but two of those were alternate suggestions for how to suppress them. --- sys/unix/unixmain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 1d6500b68..c800c4919 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -768,18 +768,18 @@ error: unsigned long sys_random_seed() { - unsigned long seed; + unsigned long seed = 0L; unsigned long pid = (unsigned long) getpid(); boolean no_seed = TRUE; #ifdef DEV_RANDOM - FILE *fptr = NULL; + FILE *fptr; fptr = fopen(DEV_RANDOM, "r"); if (fptr) { - fread(&seed, sizeof(long), 1, fptr); + fread(&seed, sizeof long, 1, fptr); has_strong_rngseed = TRUE; /* decl.c */ no_seed = FALSE; - fclose(fptr); + (void) fclose(fptr); } else { /* leaves clue, doesn't exit */ paniclog("sys_random_seed", "falling back to weak seed"); -- 2.40.0