A ^Z signals the whole process group, causing the parent process (vipw) to
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 26 Dec 2005 20:18:56 +0000 (20:18 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 26 Dec 2005 20:18:56 +0000 (20:18 +0000)
commit591869696d683a93d3c005605aafc0137ef167d0
tree34345194f9084fbb6ad6daf151f87c1ad25def14
parent73a708ea41663b0041fb8f6cd986ac7ee40ae851
A ^Z signals the whole process group, causing the parent process (vipw) to
return a stopped status for the child AND to go to sleep at the same time.

Originally the parent (vipw) stopped before it checked the child state, and
thus would not 'notice' the child going into a stopped state because the
parent would get interrupted by the SIGCONT, execute the wakeup of the
child (vi), then restart the wait*().

But now due to the fact that the process no longer enters a STOPPED
state until it actually tries to return to userland, the wait*() call will
in fact try to return the child's 'old' stopped state when both processes
are stopped with TSTP, then return it when the parent process is woken up
by the SIGCONT.

For now solve the problem by not trying to check the stopped status of
the child.

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
usr.sbin/vipw/pw_util.c