Date: Thu, 28 Mar 2013 09:03:15 +0000 (UTC) From: Gavin Atkinson <gavin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248821 - stable/8/lib/libc/stdlib Message-ID: <201303280903.r2S93FEO073698@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303280903.r2S93FEO073698>