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:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user