Don't use an uninitialised variable.

A compiler is well within its rights to throw this value away completely (and clang does so).

See http://kqueue.org/blog/2012/06/25/more-randomness-or-less/
This commit is contained in:
Daniel O'Connor 2012-09-01 16:32:50 +09:30
parent e7201963d0
commit 9546903ce7

View File

@ -77,8 +77,7 @@ srandomdev(void)
{
gettimeofday(&tv, NULL);
/* NOTE: intentional use of uninitialized variable */
seed ^= (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec;
seed = (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec;
}
srandom(seed);
}