summaryrefslogtreecommitdiffstats
path: root/vncauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'vncauth.c')
-rw-r--r--vncauth.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vncauth.c b/vncauth.c
index f701b84..39ba856 100644
--- a/vncauth.c
+++ b/vncauth.c
@@ -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);
}