summaryrefslogtreecommitdiffstats
path: root/vncauth.c
diff options
context:
space:
mode:
authordscho <dscho>2003-07-28 00:57:52 +0000
committerdscho <dscho>2003-07-28 00:57:52 +0000
commit9f0a1a3bc16d26420c703c6e6cc0f18bd4f6b81e (patch)
tree0aa185de6ff17df411ce24001954435a524a970e /vncauth.c
parentb9ebdab1f255316ccb9160daa0976d57adfe2675 (diff)
downloadlibtdevnc-9f0a1a3bc16d26420c703c6e6cc0f18bd4f6b81e.tar.gz
libtdevnc-9f0a1a3bc16d26420c703c6e6cc0f18bd4f6b81e.zip
synced with TightVNC and RealVNC
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);
}