From 9546903ce7b309e0ddf21ab67208a150f280a795 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 1 Sep 2012 16:32:50 +0930 Subject: [PATCH] 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/ --- srandomdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srandomdev.c b/srandomdev.c index 16c141e5..17fb41fb 100644 --- a/srandomdev.c +++ b/srandomdev.c @@ -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); }