diff options
author | runge <runge> | 2008-09-14 19:28:25 +0000 |
---|---|---|
committer | runge <runge> | 2008-09-14 19:28:25 +0000 |
commit | 95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4 (patch) | |
tree | 37da2bfec58413d02c9fbe59f86e848bf0fec348 /x11vnc/util.c | |
parent | d5cba7a574a667f5321194cb05d0b4adcb995866 (diff) | |
download | libtdevnc-95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4.tar.gz libtdevnc-95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4.zip |
x11vnc: -sleepin m-n for random sleep. More mktemp and mkstemp
protections. SSL_INIT_TIMEOUT=n env. var. Fix macosx console
X call bug. Synchronize other projects sources.
Diffstat (limited to 'x11vnc/util.c')
-rw-r--r-- | x11vnc/util.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/x11vnc/util.c b/x11vnc/util.c index 7b59bb2..8e18781 100644 --- a/x11vnc/util.c +++ b/x11vnc/util.c @@ -399,8 +399,23 @@ double rnow(void) { } double rfac(void) { - double f = (double) rand(); + double f; + static int first = 1; + + if (first) { + unsigned int s; + if (getenv("RAND_SEED")) { + s = (unsigned int) atoi(getenv("RAND_SEED")); + } else { + s = (unsigned int) ((int) getpid() + 100000 * rnow()); + } + srand(s); + first = 0; + } + + f = (double) rand(); f = f / ((double) RAND_MAX); + return f; } |