config: Apply config value validation to logging_level option

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
master
Ken ICHIKAWA 2013-06-04 14:00:31 +09:00 committed by Richard Cochran
parent 306f83e7b1
commit a92f42de38
1 changed files with 4 additions and 3 deletions

View File

@ -309,9 +309,10 @@ static enum parser_result parse_global_setting(const char *option,
*cfg->udp6_scope = u8;
} else if (!strcmp(option, "logging_level")) {
if (1 != sscanf(value, "%d", &val) ||
val < PRINT_LEVEL_MIN || val > PRINT_LEVEL_MAX)
return BAD_VALUE;
r = get_ranged_int(value, &val,
PRINT_LEVEL_MIN, PRINT_LEVEL_MAX);
if (r != PARSED_OK)
return r;
if (!(cfg_ignore & CFG_IGNORE_PRINT_LEVEL)) {
cfg->print_level = val;
}