Date: Wed, 30 May 2012 03:55:44 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r236286 - head/usr.bin/mail Message-ID: <201205300355.q4U3tia1024287@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Wed May 30 03:55:44 2012 New Revision: 236286 URL: http://svn.freebsd.org/changeset/base/236286 Log: 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 Modified: head/usr.bin/mail/popen.c Modified: head/usr.bin/mail/popen.c ============================================================================== --- head/usr.bin/mail/popen.c Wed May 30 03:54:10 2012 (r236285) +++ head/usr.bin/mail/popen.c Wed May 30 03:55:44 2012 (r236286) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205300355.q4U3tia1024287>