Use ending of normal mode to signal a failure.
static int initialised = 0;
-/* ================================================== */
+static int exit_status = 0;
static int reload = 0;
void
MAI_CleanupAndExit(void)
{
- if (!initialised) exit(0);
+ if (!initialised) exit(exit_status);
if (CNF_GetDumpOnExit()) {
SRC_DumpSources();
LOG_Finalise();
- exit(0);
+ exit(exit_status);
}
/* ================================================== */
{
switch (ref_mode) {
case REF_ModeNormal:
+ exit_status = !result;
+ SCH_QuitProgram();
break;
case REF_ModeInitStepSlew:
/* post_init_ntp_hook removes sources and a source call is
"Adjustment of %.3f seconds exceeds the allowed maximum of %.3f seconds (%s) ",
offset, max_offset, !max_offset_ignore ? "exiting" : "ignored");
if (!max_offset_ignore)
- SCH_QuitProgram();
+ end_ref_mode(0);
else if (max_offset_ignore > 0)
max_offset_ignore--;
return 0;