fsck: fix incorrect handling of child exit
No binary (build failed)
—
(log yok)
| @@ -414,7 +414,7 @@ static void kill_all_if_got_signal(void) | |
| static int wait_one(int flags) | |
| { | |
| int status; | |
| - | int sig; |
| + | int exitcode; |
| struct fsck_instance *inst, *prev; | |
| pid_t pid; | |
| @@ -448,15 +448,16 @@ static int wait_one(int flags) | |
| } | |
| child_died: | |
| - | status = WEXITSTATUS(status); |
| + | exitcode = WEXITSTATUS(status); |
| if (WIFSIGNALED(status)) { | |
| + | unsigned sig; |
| sig = WTERMSIG(status); | |
| - | status = EXIT_UNCORRECTED; |
| + | exitcode = EXIT_UNCORRECTED; |
| if (sig != SIGINT) { | |
| printf("Warning: %s %s terminated " | |
| - | "by signal %d\n", |
| + | "by signal %u\n", |
| inst->prog, inst->device, sig); | |
| - | status = EXIT_ERROR; |
| + | exitcode = EXIT_ERROR; |
| } | |
| } | |
| @@ -492,12 +493,12 @@ static int wait_one(int flags) | |
| else | |
| G.instance_list = inst->next; | |
| if (G.verbose > 1) | |
| - | printf("Finished with %s (exit status %d)\n", |
| - | inst->device, status); |
| + | printf("Finished with %s (exit status %u)\n", |
| + | inst->device, exitcode); |
| G.num_running--; | |
| free_instance(inst); | |
| - | return status; |
| + | return exitcode; |
| } | |
| /* | |