From 0c571784a320f1fa8f47284fe36410b84e0c85bc Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Fri, 24 Apr 2009 22:49:20 +0000 Subject: [PATCH] * libmisc/salt.c: In case gettimeofday() fails, get some entropy from the PID. --- ChangeLog | 5 +++++ libmisc/salt.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f98f82c..0cab3de7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-25 Nicolas François + + * libmisc/salt.c: In case gettimeofday() fails, get some entropy + from the PID. + 2009-04-25 Nicolas François * libmisc/setupenv.c: Prefer snprintf to sprintf, even if a small diff --git a/libmisc/salt.c b/libmisc/salt.c index 68126293..99233c68 100644 --- a/libmisc/salt.c +++ b/libmisc/salt.c @@ -69,8 +69,8 @@ static void seedRNG (void) static int seeded = 0; if (0 == seeded) { - gettimeofday(&tv, NULL); - srandom (tv.tv_sec + tv.tv_usec); + (void) gettimeofday (&tv, NULL); + srandom (tv.tv_sec ^ tv.tv_usec ^ getpid ()); seeded = 1; } } -- 2.40.0