This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/2] Use urandom to get random seed
On Tue, 27 Sep 2011, Andi Kleen wrote:
> if (!flag_random_seed)
> {
> + /* Try urandom first. Time of day is too likely to collide. */
> +
> + int fd = open("/dev/urandom", O_RDONLY);
> + read(fd, &random_seed, sizeof(random_seed));
> + close(fd);
There appear to be no error checks and an unconditional fallthrough to the
HAVE_GETTIMEOFDAY code. Also, missing spaces before open parentheses.
--
Joseph S. Myers
joseph@codesourcery.com