From owner-svn-src-head@FreeBSD.ORG Wed Apr 3 14:14:02 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4A307EED; Wed, 3 Apr 2013 14:14:02 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 14AEC2A0; Wed, 3 Apr 2013 14:14:01 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 82DA4CBD; Wed, 3 Apr 2013 16:10:31 +0200 (CEST) Date: Wed, 3 Apr 2013 16:15:57 +0200 From: Pawel Jakub Dawidek To: Bruce Evans Subject: Re: svn commit: r249035 - head/lib/libc/stdlib Message-ID: <20130403141557.GB1349@garage.freebsd.pl> References: <201304022341.r32NfL8L096954@svn.freebsd.org> <20130403165736.F819@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <20130403165736.F819@besplex.bde.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2013 14:14:02 -0000 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D 0; > > - fd =3D _open("/dev/random", O_RDONLY | O_CLOEXEC, 0); > > - if (fd >=3D 0) { > > - if (_read(fd, (void *) &next, sizeof(next)) =3D=3D sizeof(next)) > > - done =3D 1; > > - _close(fd); > > - } > > - > > - if (!done) { > > - struct timeval tv; > > - > > - gettimeofday(&tv, NULL); > > - srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); > > - } >=20 > _open() and _read() are unlikely to fail, [...] They are very likely to fail when the process is sandboxed. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFcOZ0ACgkQForvXbEpPzRj+gCgpya1sbMIKDsE90d5qAeoZM3i x90AoJLTeA78UOEL6v7OIPyKkZM1iN9W =/5CI -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V--