svn commit: r249035 - head/lib/libc/stdlib
Pawel Jakub Dawidek
pjd at FreeBSD.org
Wed Apr 3 14:14:02 UTC 2013
On Wed, Apr 03, 2013 at 06:04:37PM +1100, Bruce Evans wrote:
> On Tue, 2 Apr 2013, Xin LI wrote:
> > void
> > sranddev()
> > {
> > - int fd, done;
> > + int mib[2];
> > + size_t len;
> >
> > - done = 0;
> > - fd = _open("/dev/random", O_RDONLY | O_CLOEXEC, 0);
> > - if (fd >= 0) {
> > - if (_read(fd, (void *) &next, sizeof(next)) == sizeof(next))
> > - done = 1;
> > - _close(fd);
> > - }
> > -
> > - if (!done) {
> > - struct timeval tv;
> > -
> > - gettimeofday(&tv, NULL);
> > - srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec);
> > - }
>
> _open() and _read() are unlikely to fail, [...]
They are very likely to fail when the process is sandboxed.
--
Pawel Jakub Dawidek http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20130403/9336b3dd/attachment.sig>
More information about the svn-src-head
mailing list