fix bug in fread() failure check

the two middle arguments to fread() are easily confused, and cause the
checking of return value to fail incorrectly (and possibly succeed
incorrectly.)
This commit is contained in:
Don Viszneki 2018-03-05 18:45:00 -08:00
parent cddef0c0be
commit 8b3841c91d
1 changed files with 1 additions and 1 deletions

View File

@ -4918,7 +4918,7 @@ int main(int argc, char **argv) {
}
} else {
FILE *frand = fopen("/dev/urandom", "r");
if ((frand == NULL) || fread(&seed16, sizeof(seed16), 1, frand) != sizeof(seed16)) {
if ((frand == NULL) || fread(&seed16, 1, sizeof(seed16), frand) != sizeof(seed16)) {
fprintf(stderr, "WARNING: could not read 16 bytes from /dev/urandom; falling back to insecure PRNG\n");
uint64_t t = time(NULL) * (uint64_t)1337;
seed16[0] ^= t;