diff options
author | Ruslan Ermilov <ru@nginx.com> | 2016-08-04 23:43:10 +0300 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2016-08-04 23:43:10 +0300 |
commit | 42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d (patch) | |
tree | a67b3ec99148133d6b8a87d22319b25478df7377 /src/os/unix/ngx_posix_init.c | |
parent | 31389e4921c81bd7a3b82a95032e60e13454bae4 (diff) | |
download | nginx-42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d.tar.gz nginx-42f6e1f78e71557b7c6bee0cf77e000aa3c00f6d.zip |
Always seed PRNG with PID, seconds, and milliseconds.
Diffstat (limited to 'src/os/unix/ngx_posix_init.c')
-rw-r--r-- | src/os/unix/ngx_posix_init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c index 76ed94e90..7e6e79d01 100644 --- a/src/os/unix/ngx_posix_init.c +++ b/src/os/unix/ngx_posix_init.c @@ -33,7 +33,8 @@ ngx_os_io_t ngx_os_io = { ngx_int_t ngx_os_init(ngx_log_t *log) { - ngx_uint_t n; + ngx_time_t *tp; + ngx_uint_t n; #if (NGX_HAVE_OS_SPECIFIC_INIT) if (ngx_os_specific_init(log) != NGX_OK) { @@ -76,7 +77,8 @@ ngx_os_init(ngx_log_t *log) ngx_inherited_nonblocking = 0; #endif - srandom(ngx_time()); + tp = ngx_timeofday(); + srandom(((unsigned) ngx_pid << 16) ^ tp->sec ^ tp->msec); return NGX_OK; } |