Exit code and logging invariants for log_fatal and hardware log_error
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-09-20 15:56:14 +02:00
parent c2d46f4039
commit 51b5020b8e
14 changed files with 120 additions and 24 deletions

View file

@ -1503,11 +1503,15 @@ int snapraid_main(int argc, char* argv[])
state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail);
if (opt.gui_touch_before) {
state_touch(&state);
ret = state_touch(&state);
/* save the new state if required */
if (state.need_write)
state_write(&state);
if (ret != 0) {
exit(EXIT_FAILURE);
}
}
ret = state_snapshot_scan(&state);
@ -1652,7 +1656,7 @@ int snapraid_main(int argc, char* argv[])
memory();
state_touch(&state);
ret = state_touch(&state);
/*
* Intercept signals while operating
@ -1779,6 +1783,10 @@ int snapraid_main(int argc, char* argv[])
/* LCOV_EXCL_STOP */
}
/* force failure if hardware errors were encountered */
if (ret == 0 && log_hardware_errors() != 0)
ret = -1;
/* close log file */
log_close(log_file);