diff --git a/cmdline/check.c b/cmdline/check.c index 05365784..c1fe274b 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -942,7 +942,9 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* check all the blocks in files */ countsize = 0; countpos = 0; - state_progress_begin(state, blockstart, blockmax, countmax); + if (!state_progress_begin(state, blockstart, blockmax, countmax)) + goto end; + for (i = blockstart; i < blockmax; ++i) { unsigned failed_count; int valid_parity; @@ -1816,6 +1818,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna } } +end: state_progress_end(state, countpos, countmax, countsize); bail: diff --git a/cmdline/dry.c b/cmdline/dry.c index 7ede62b6..202f4e76 100644 --- a/cmdline/dry.c +++ b/cmdline/dry.c @@ -199,7 +199,9 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit /* start all the worker threads */ io_start(&io, blockstart, blockmax, 0); - state_progress_begin(state, blockstart, blockmax, countmax); + if (!state_progress_begin(state, blockstart, blockmax, countmax)) + goto end; + while (1) { void** buffer; @@ -345,6 +347,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit } } +end: state_progress_end(state, countpos, countmax, countsize); state_usage_print(state); diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 922f40ec..3fc0f5c8 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -320,7 +320,9 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* start all the worker threads */ io_start(&io, blockstart, blockmax, block_enabled); - state_progress_begin(state, blockstart, blockmax, countmax); + if (!state_progress_begin(state, blockstart, blockmax, countmax)) + goto end; + while (1) { unsigned char* buffer_recov[LEV_MAX]; snapraid_info info; @@ -647,6 +649,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par } } +end: state_progress_end(state, countpos, countmax, countsize); state_usage_print(state);