Fix likely race condition if wait_child() is interrupted by sigchild()
PR: bin/102834 Submitted by: Andreas Longwitz <longwitz@incore.de> Approved by: cperciva MFC after: 2 weeks
This commit is contained in:
parent
5e4cc10b6d
commit
35f8ab70be
@ -336,12 +336,14 @@ int
|
||||
wait_child(int pid)
|
||||
{
|
||||
sigset_t nset, oset;
|
||||
struct child *cp = findchild(pid);
|
||||
struct child *cp;
|
||||
|
||||
(void)sigemptyset(&nset);
|
||||
(void)sigaddset(&nset, SIGCHLD);
|
||||
(void)sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
|
||||
cp = findchild(pid);
|
||||
|
||||
while (!cp->done)
|
||||
(void)sigsuspend(&oset);
|
||||
wait_status = cp->status;
|
||||
|
Loading…
Reference in New Issue
Block a user