tests: Make sure we get the requested number of bytes from /dev/urandom
This commit is contained in:
parent
c95f6f1360
commit
82a96e4587
@ -4913,7 +4913,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FILE *frand = fopen("/dev/urandom", "r");
|
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;
|
uint64_t t = time(NULL) * (uint64_t)1337;
|
||||||
seed16[0] ^= t;
|
seed16[0] ^= t;
|
||||||
seed16[1] ^= t >> 8;
|
seed16[1] ^= t >> 8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user