svn commit: r248821 - stable/8/lib/libc/stdlib
Gavin Atkinson
gavin at FreeBSD.org
Thu Mar 28 09:03:16 UTC 2013
Author: gavin
Date: Thu Mar 28 09:03:15 2013
New Revision: 248821
URL: http://svnweb.freebsd.org/changeset/base/248821
Log:
When r241373 was merged, one file appears to have been missed from the
commit. Merge it:
Remove undefined behavior from sranddev() and
srandomdev(). This doesn't actually work
with any modern C compiler:
In particular, both clang and modern gcc
verisons silently elide any xor operation
with 'junk'.
No mergeinfo changes with this commit as r241475 already updated the
mergeinfo.
Modified:
stable/8/lib/libc/stdlib/random.c
Modified: stable/8/lib/libc/stdlib/random.c
==============================================================================
--- stable/8/lib/libc/stdlib/random.c Thu Mar 28 08:13:52 2013 (r248820)
+++ stable/8/lib/libc/stdlib/random.c Thu Mar 28 09:03:15 2013 (r248821)
@@ -315,10 +315,9 @@ srandomdev()
if (!done) {
struct timeval tv;
- unsigned long junk;
gettimeofday(&tv, NULL);
- srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
+ srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec);
return;
}
More information about the svn-src-stable
mailing list