diff options
Diffstat (limited to 'vncauth.c')
-rw-r--r-- | vncauth.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -142,9 +142,13 @@ void vncRandomBytes(unsigned char *bytes) { int i; - unsigned int seed = (unsigned int) time(0); + static Bool s_srandom_called = FALSE; + + if (!s_srandom_called) { + srandom((unsigned int)time(0) ^ (unsigned int)getpid()); + s_srandom_called = TRUE; + } - srandom(seed); for (i = 0; i < CHALLENGESIZE; i++) { bytes[i] = (unsigned char)(random() & 255); } |