Mercurial > hg > nginx-quic
diff src/os/win32/ngx_win32_init.c @ 6651:7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 04 Aug 2016 23:43:10 +0300 |
parents | 293413010217 |
children | 56fc55e32f23 |
line wrap: on
line diff
--- a/src/os/win32/ngx_win32_init.c +++ b/src/os/win32/ngx_win32_init.c @@ -59,12 +59,13 @@ static GUID dx_guid = WSAID_DISCONNECTEX ngx_int_t ngx_os_init(ngx_log_t *log) { - DWORD bytes; - SOCKET s; - WSADATA wsd; - ngx_err_t err; - ngx_uint_t n; - SYSTEM_INFO si; + DWORD bytes; + SOCKET s; + WSADATA wsd; + ngx_err_t err; + ngx_time_t *tp; + ngx_uint_t n; + SYSTEM_INFO si; /* get Windows version */ @@ -237,7 +238,8 @@ ngx_os_init(ngx_log_t *log) ngx_sprintf((u_char *) ngx_unique, "%P%Z", ngx_pid); } - srand((ngx_pid << 16) ^ (unsigned) ngx_time()); + tp = ngx_timeofday(); + srand((ngx_pid << 16) ^ (unsigned) tp->sec ^ tp->msec); return NGX_OK; }