Commit 39d60cdf authored by Pavel Emelyanov's avatar Pavel Emelyanov

rst: Sanitize sigchld handler

The error handling was not obvious. Clean it up.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 815049bc
...@@ -878,7 +878,6 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data) ...@@ -878,7 +878,6 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
if (!current || status) if (!current || status)
goto err; goto err;
/* Skip a helper if it was completed successfully */
while (pid) { while (pid) {
pid = waitpid(-1, &status, WNOHANG); pid = waitpid(-1, &status, WNOHANG);
if (pid <= 0) if (pid <= 0)
...@@ -889,15 +888,14 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data) ...@@ -889,15 +888,14 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
if (status) if (status)
break; break;
list_for_each_entry(pi, &current->children, sibling) { /* Exited (with zero code) helpers are OK */
if (pi->state != TASK_HELPER) list_for_each_entry(pi, &current->children, sibling)
continue;
if (pi->pid.virt == siginfo->si_pid) if (pi->pid.virt == siginfo->si_pid)
break; break;
}
if (&pi->sibling == &current->children) BUG_ON(&pi->sibling == &current->children);
break; /* The process is not a helper */ if (pi->state != TASK_HELPER)
break;
} }
err: err:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment