Add a long-overdue nail to the deprecated /dev/urandom interface
by asking some things that need unpredictable numbers to read /dev/random instead.
This commit is contained in:
parent
e3a5468ff8
commit
6187976edf
@ -119,7 +119,7 @@ sranddev()
|
||||
int fd, done;
|
||||
|
||||
done = 0;
|
||||
fd = _open("/dev/urandom", O_RDONLY, 0);
|
||||
fd = _open("/dev/random", O_RDONLY, 0);
|
||||
if (fd >= 0) {
|
||||
if (_read(fd, (void *) &next, sizeof(next)) == sizeof(next))
|
||||
done = 1;
|
||||
|
@ -300,7 +300,7 @@ srandomdev()
|
||||
len = rand_deg * sizeof state[0];
|
||||
|
||||
done = 0;
|
||||
fd = _open("/dev/urandom", O_RDONLY, 0);
|
||||
fd = _open("/dev/random", O_RDONLY, 0);
|
||||
if (fd >= 0) {
|
||||
if (_read(fd, (void *) state, len) == (ssize_t) len)
|
||||
done = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user