Fixed range checking for the "somaxconn" sysctl.

This commit is contained in:
Ruslan Ermilov 2011-10-25 13:48:05 +00:00
parent 620718102b
commit c5762451a9
2 changed files with 5 additions and 12 deletions

View File

@ -88,7 +88,6 @@ ngx_debug_init()
ngx_int_t
ngx_os_specific_init(ngx_log_t *log)
{
int somaxconn;
size_t size;
ngx_err_t err;
ngx_uint_t i;
@ -155,12 +154,9 @@ ngx_os_specific_init(ngx_log_t *log)
ngx_ncpu = ngx_darwin_hw_ncpu;
somaxconn = 32676;
if (ngx_darwin_kern_ipc_somaxconn > somaxconn) {
if (ngx_darwin_kern_ipc_somaxconn > 32767) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
"sysctl kern.ipc.somaxconn must be no more than %d",
somaxconn);
"sysctl kern.ipc.somaxconn must be less than 32768");
return NGX_ERROR;
}

View File

@ -98,7 +98,7 @@ ngx_debug_init()
ngx_int_t
ngx_os_specific_init(ngx_log_t *log)
{
int version, somaxconn;
int version;
size_t size;
ngx_err_t err;
ngx_uint_t i;
@ -210,12 +210,9 @@ ngx_os_specific_init(ngx_log_t *log)
ngx_ncpu = ngx_freebsd_hw_ncpu;
}
somaxconn = version < 600008 ? 32676 : 65535;
if (ngx_freebsd_kern_ipc_somaxconn > somaxconn) {
if (version < 600008 && ngx_freebsd_kern_ipc_somaxconn > 32767) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
"sysctl kern.ipc.somaxconn must be no more than %d",
somaxconn);
"sysctl kern.ipc.somaxconn must be less than 32768");
return NGX_ERROR;
}