From ef9ea5f967ff94f88917ba119384e26cd963dca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Loyet?= Date: Sat, 8 May 2010 08:52:32 +0000 Subject: [PATCH] Fix #51736, wrong checks on dynamic parameters --- sapi/fpm/fpm/fpm_conf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 2b8f7725dd4..d451057c143 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -441,25 +441,26 @@ static int fpm_conf_process_all_pools() /* {{{ */ return -1; } - if (config->pm_max_spare_servers > config->pm_max_children || + if (config->pm_min_spare_servers > config->pm_max_children || config->pm_max_spare_servers > config->pm_max_children) { zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] min_spare_servers(%d) and max_spare_servers(%d) cannot be greater than max_children(%d)", - wp->config->name, config->pm_max_spare_servers, config->pm_max_spare_servers, config->pm_max_children); + wp->config->name, config->pm_min_spare_servers, config->pm_max_spare_servers, config->pm_max_children); return -1; } - if (config->pm_max_spare_servers < config->pm_max_spare_servers) { - zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must not be less than min_spare_servers(%d)", wp->config->name, config->pm_max_spare_servers, config->pm_max_spare_servers); + if (config->pm_max_spare_servers < config->pm_min_spare_servers) { + zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must not be less than min_spare_servers(%d)", wp->config->name, config->pm_max_spare_servers, config->pm_min_spare_servers); return -1; } if (config->pm_start_servers <= 0) { config->pm_start_servers = config->pm_min_spare_servers + ((config->pm_max_spare_servers - config->pm_min_spare_servers) / 2); zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] start_servers is not set. It's been set to %d.", wp->config->name, config->pm_start_servers); - } else if (config->pm_start_servers < config->pm_max_spare_servers || config->pm_start_servers > config->pm_max_spare_servers) { - zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] start_servers(%d) must not be less than min_spare_servers(%d) and not greater than max_spare_servers(%d)", wp->config->name, config->pm_start_servers, config->pm_max_spare_servers, config->pm_max_spare_servers); + } else if (config->pm_start_servers < config->pm_min_spare_servers || config->pm_start_servers > config->pm_max_spare_servers) { + zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] start_servers(%d) must not be less than min_spare_servers(%d) and not greater than max_spare_servers(%d)", wp->config->name, config->pm_start_servers, config->pm_min_spare_servers, config->pm_max_spare_servers); return -1; } + }