mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 10:38:06 +00:00
rst: Sanitize sigchld handler
The error handling was not obvious. Clean it up. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
815049bcdb
commit
39d60cdfef
1 changed files with 5 additions and 7 deletions
12
cr-restore.c
12
cr-restore.c
|
|
@ -878,7 +878,6 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
|
|||
if (!current || status)
|
||||
goto err;
|
||||
|
||||
/* Skip a helper if it was completed successfully */
|
||||
while (pid) {
|
||||
pid = waitpid(-1, &status, WNOHANG);
|
||||
if (pid <= 0)
|
||||
|
|
@ -889,15 +888,14 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
|
|||
if (status)
|
||||
break;
|
||||
|
||||
list_for_each_entry(pi, ¤t->children, sibling) {
|
||||
if (pi->state != TASK_HELPER)
|
||||
continue;
|
||||
/* Exited (with zero code) helpers are OK */
|
||||
list_for_each_entry(pi, ¤t->children, sibling)
|
||||
if (pi->pid.virt == siginfo->si_pid)
|
||||
break;
|
||||
}
|
||||
|
||||
if (&pi->sibling == ¤t->children)
|
||||
break; /* The process is not a helper */
|
||||
BUG_ON(&pi->sibling == ¤t->children);
|
||||
if (pi->state != TASK_HELPER)
|
||||
break;
|
||||
}
|
||||
|
||||
err:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue