Browse Source

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

master
practicalswift 5 years ago
parent
commit
82a96e4587
  1. 2
      src/tests.c

2
src/tests.c

@ -4913,7 +4913,7 @@ int main(int argc, char **argv) { @@ -4913,7 +4913,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;

Loading…
Cancel
Save