mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Even better error management. More precise and explicative.
This commit is contained in:
parent
37c68721a1
commit
e80009334b
7 changed files with 108 additions and 37 deletions
13
snapraid.c
13
snapraid.c
|
|
@ -83,6 +83,7 @@ int main(int argc, char* argv[])
|
|||
struct snapraid_state state;
|
||||
int operation;
|
||||
block_off_t blockstart;
|
||||
int ret;
|
||||
|
||||
/* intercept Ctrl+C */
|
||||
signal(SIGINT, &signal_handler);
|
||||
|
|
@ -158,10 +159,16 @@ int main(int argc, char* argv[])
|
|||
|
||||
state_scan(&state);
|
||||
|
||||
state_sync(&state, blockstart);
|
||||
ret = state_sync(&state, blockstart);
|
||||
|
||||
state_write(&state);
|
||||
} else if (operation == OPERATION_CHECK || operation == OPERATION_FIX) {
|
||||
/* save the new state if required */
|
||||
if (state.need_write)
|
||||
state_write(&state);
|
||||
|
||||
/* abort if required by the sync command */
|
||||
if (ret == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
state_read(&state);
|
||||
|
||||
state_check(&state, operation == OPERATION_FIX, blockstart);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue