From 96547a1c0db15423da4dee47c1ef003b9c62f2f2 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 4 Nov 2016 10:48:02 +0200 Subject: [PATCH] Fix failure to exit on configuration error The check for the success of the configuration file always resulted in a successful return value even if the loading failed. In addition to this, a log message referred to the active configuration when the active configuration was set only after the processing was complete. Since configuration failures are always fatal, there's no harm in preemptively setting the active configuration to the one currently being processed. --- server/core/config.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/core/config.c b/server/core/config.c index f85d685d6..7958cb175 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -601,9 +601,9 @@ config_load_and_process(const char* filename, bool (*process_config)(CONFIG_CONT if (rval) { - if (check_config_objects(ccontext.next) && process_config(ccontext.next)) + if (!check_config_objects(ccontext.next) || !process_config(ccontext.next)) { - rval = true; + rval = false; } } } @@ -633,13 +633,9 @@ config_load(const char *filename) global_defaults(); feedback_defaults(); + config_file = filename; bool rval = config_load_and_process(filename, process_config_context); - if (rval) - { - config_file = filename; - } - return rval; }