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
3f451eb3b1
commit
336581c2f4
@ -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