Added per-process random seeding (ticket #456).

This commit is contained in:
Maxim Dounin 2014-01-04 03:32:06 +04:00
parent 9a72030c25
commit 1029607ac9
2 changed files with 3 additions and 1 deletions

View File

@ -959,6 +959,8 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker)
"sigprocmask() failed");
}
srandom((ngx_pid << 16) ^ ngx_time());
/*
* disable deleting previous events for the listening sockets because
* in the worker processes there are no events at all at this point

View File

@ -228,7 +228,7 @@ ngx_os_init(ngx_log_t *log)
ngx_sprintf((u_char *) ngx_unique, "%P%Z", ngx_pid);
}
srand((unsigned) ngx_time());
srand((ngx_pid << 16) ^ (unsigned) ngx_time());
return NGX_OK;
}