svn commit: r239549 - stable/9/lib/libc/stdlib

Kevin Lo kevlo at FreeBSD.org
Wed Aug 22 00:59:18 UTC 2012


Author: kevlo
Date: Wed Aug 22 00:59:17 2012
New Revision: 239549
URL: http://svn.freebsd.org/changeset/base/239549

Log:
  MFC r239345:
  Make 'junk' volatile so that compilers won't be tempted to optimize
  
  Reviewed by:	ache

Modified:
  stable/9/lib/libc/stdlib/random.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/stdlib/random.c
==============================================================================
--- stable/9/lib/libc/stdlib/random.c	Tue Aug 21 23:55:29 2012	(r239548)
+++ stable/9/lib/libc/stdlib/random.c	Wed Aug 22 00:59:17 2012	(r239549)
@@ -315,7 +315,7 @@ srandomdev()
 
 	if (!done) {
 		struct timeval tv;
-		unsigned long junk;
+		volatile unsigned long junk;
 
 		gettimeofday(&tv, NULL);
 		srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);


More information about the svn-src-stable-9 mailing list