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.
This commit is contained in:
Markus Makela
2016-11-04 10:48:02 +02:00
parent f38b510d2b
commit 96547a1c0d

View File

@ -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,12 +633,8 @@ config_load(const char *filename)
global_defaults();
feedback_defaults();
bool rval = config_load_and_process(filename, process_config_context);
if (rval)
{
config_file = filename;
}
bool rval = config_load_and_process(filename, process_config_context);
return rval;
}