mirror of
https://github.com/nginx/nginx.git
synced 2026-10-25 05:23:31 +00:00
Added per-process random seeding (ticket #456).
This commit is contained in:
parent
9a72030c25
commit
1029607ac9
2 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue