aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_process_cycle.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-08-04 23:43:10 +0300
committerRuslan Ermilov <ru@nginx.com>2016-08-04 23:43:10 +0300
commit42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d (patch)
treea67b3ec99148133d6b8a87d22319b25478df7377 /src/os/unix/ngx_process_cycle.c
parent31389e4921c81bd7a3b82a95032e60e13454bae4 (diff)
downloadnginx-42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d.tar.gz
nginx-42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d.zip
Always seed PRNG with PID, seconds, and milliseconds.
Diffstat (limited to 'src/os/unix/ngx_process_cycle.c')
-rw-r--r--src/os/unix/ngx_process_cycle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 8c2d968a5..83b04ee62 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -785,6 +785,7 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker)
{
sigset_t set;
ngx_int_t n;
+ ngx_time_t *tp;
ngx_uint_t i;
ngx_cpuset_t *cpu_affinity;
struct rlimit rlmt;
@@ -884,7 +885,8 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker)
"sigprocmask() failed");
}
- srandom(((unsigned) ngx_pid << 16) ^ ngx_time());
+ tp = ngx_timeofday();
+ srandom(((unsigned) ngx_pid << 16) ^ tp->sec ^ tp->msec);
/*
* disable deleting previous events for the listening sockets because