From e21448831d0cacf0dd7abbd85671f77566ed41b0 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 17 Mar 2015 08:19:29 +0900 Subject: [PATCH] Standardize configuration error messages for 'failover' parameter. Better to fail with an error than assume a default value if an unrecognized value is detected. --- config.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c index c8b82b08..cabdfebb 100644 --- a/config.c +++ b/config.c @@ -180,13 +180,17 @@ parse_config(const char *config_file, t_configuration_options *options) strncpy(failoverstr, value, MAXLEN); if (strcmp(failoverstr, "manual") == 0) + { options->failover = MANUAL_FAILOVER; + } else if (strcmp(failoverstr, "automatic") == 0) + { options->failover = AUTOMATIC_FAILOVER; + } else { - log_warning(_("Value for failover option is incorrect, it should be 'automatic' or 'manual'. Defaulting to manual.\n")); - options->failover = MANUAL_FAILOVER; + log_err(_("value for 'failover' must be 'automatic' or 'manual'\n")); + exit(ERR_BAD_CONFIG); } } else if (strcmp(name, "priority") == 0) @@ -394,7 +398,7 @@ reload_config(char *config_file, t_configuration_options * orig_options) if (new_options.failover != MANUAL_FAILOVER && new_options.failover != AUTOMATIC_FAILOVER) { - log_warning(_("new value for 'failover' must be MANUAL or AUTOMATIC\n")); + log_warning(_("new value for 'failover' must be 'automatic' or 'manual'\n")); return false; }