]> granicus.if.org Git - shadow/commitdiff
* libmisc/salt.c: In case gettimeofday() fails, get some entropy
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 24 Apr 2009 22:49:20 +0000 (22:49 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 24 Apr 2009 22:49:20 +0000 (22:49 +0000)
from the PID.

ChangeLog
libmisc/salt.c

index 0f98f82c060ed01c88d1bf95641c72244d5fc7dc..0cab3de7b54833d73f9d1a0eb4b753f9f71de833 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/salt.c: In case gettimeofday() fails, get some entropy
+       from the PID.
+
 2009-04-25  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/setupenv.c: Prefer snprintf to sprintf, even if a small
index 681262934de46ea492336abeb4cc7576bb4d321b..99233c6897f0714a5d83b7e100db6206c8c81890 100644 (file)
@@ -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;
        }
 }