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:
markm 2001-10-30 21:26:50 +00:00
parent e3a5468ff8
commit 6187976edf
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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;