Merge #499: tests: Make sure we get the requested number of bytes from /dev/urandom

82a96e4 tests: Make sure we get the requested number of bytes from /dev/urandom (practicalswift)

Pull request description:

  Make sure we get the requested number of bytes from `/dev/urandom`.

Tree-SHA512: 1b035942fd2a6ee2423fb2a2a0a0f294682c51434f86e5c106fb493d77f45aa8070662190aca6441fe389b8cdcc132d432517b8e826be2ac530a1511cd0c8919
This commit is contained in:
Gregory Maxwell 2018-02-06 22:56:47 +00:00
commit f99aa8d4d3
No known key found for this signature in database
GPG Key ID: EAB5AF94D9E9ABE7
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)) {
if ((frand == NULL) || fread(&seed16, sizeof(seed16), 1, frand) != sizeof(seed16)) {
uint64_t t = time(NULL) * (uint64_t)1337;
seed16[0] ^= t;
seed16[1] ^= t >> 8;