Merge pull request #382 from StevenYGui/master

fread returns element count, not element size
This commit is contained in:
Serge Hallyn 2021-07-14 07:20:24 -05:00 committed by GitHub
commit 93086e9aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,7 +168,7 @@ static long read_random_bytes (void)
#else
FILE *f = fopen ("/dev/urandom", "r");
if (fread (&randval, sizeof (randval), 1, f) != sizeof (randval)) {
if (fread (&randval, sizeof (randval), 1, f) != 1) {
fclose(f);
goto fail;
}