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:
commit
f99aa8d4d3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue