From: nekral-guest Date: Fri, 24 Apr 2009 22:49:20 +0000 (+0000) Subject: * libmisc/salt.c: In case gettimeofday() fails, get some entropy X-Git-Tag: 4.1.4~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c571784a320f1fa8f47284fe36410b84e0c85bc;p=shadow * libmisc/salt.c: In case gettimeofday() fails, get some entropy from the PID. --- 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; } }