svn commit: r249031 - releng/8.4/lib/libc/stdlib

Gavin Atkinson gavin at FreeBSD.org
Tue Apr 2 19:33:36 UTC 2013


Author: gavin
Date: Tue Apr  2 19:33:35 2013
New Revision: 249031
URL: http://svnweb.freebsd.org/changeset/base/249031

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.
  
  Approved by:	re (jpaetzel)

Modified:
  releng/8.4/lib/libc/stdlib/random.c

Modified: releng/8.4/lib/libc/stdlib/random.c
==============================================================================
--- releng/8.4/lib/libc/stdlib/random.c	Tue Apr  2 19:07:11 2013	(r249030)
+++ releng/8.4/lib/libc/stdlib/random.c	Tue Apr  2 19:33:35 2013	(r249031)
@@ -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-releng mailing list