summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Krawczyk <pawel.krawczyk@hush.com>2015-06-19 13:53:32 +0000
committerPaweł Krawczyk <pawel.krawczyk@hush.com>2015-06-19 13:53:32 +0000
commitec86c822a08d9e0d8ffac2a7683ecb087051145a (patch)
tree9e981d06f494ce2989d47b7156448d22d00a1c29
parent28d245967752f1d3db17ba6664e459e1c1100fe8 (diff)
downloadpam_tacplus-ec86c822a08d9e0d8ffac2a7683ecb087051145a.tar.gz
pam_tacplus-ec86c822a08d9e0d8ffac2a7683ecb087051145a.zip
initialise the seed variable and update comments
-rw-r--r--libtac/lib/magic.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libtac/lib/magic.c b/libtac/lib/magic.c
index 5e27596..681c960 100644
--- a/libtac/lib/magic.c
+++ b/libtac/lib/magic.c
@@ -34,14 +34,12 @@ static int magic_initialised = 0;
* magic_init - Initialize the magic number generator.
*
* Attempts to compute a random number seed which will not repeat.
- * The current method uses the current hostid, current process ID
- * and current time, currently.
*/
void
magic_init()
{
struct stat statbuf;
- long seed;
+ long seed = 0;
struct timeval t;
if (magic_initialised)
@@ -56,7 +54,7 @@ magic_init()
}
}
- // add the deterministic data in case urandom failed
+ // fallback
gettimeofday(&t, NULL);
seed ^= gethostid() ^ t.tv_sec ^ t.tv_usec ^ getpid();