mirror of
https://github.com/nginx/nginx.git
synced 2024-12-11 09:49:02 +08:00
Added per-process random seeding (ticket #456).
This commit is contained in:
parent
9a72030c25
commit
1029607ac9
@ -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…
Reference in New Issue
Block a user