jobs: Fix infinite loop in waitproc
commit2a4f8f94a72413997ff98800fc6bf6bc028290a5
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 Apr 2020 11:03:09 +0000 (10 21:03 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Apr 2020 06:04:17 +0000 (29 16:04 +1000)
tree32bfda5a309821eb10292477c8e9edd04a09d69d
parentecd82629d6115036b1f89410a0964d251527c4ca
jobs: Fix infinite loop in waitproc

After we changed the resetting of gotsigchld so that it is only
done if jp is NULL, we can now get an infinite loop in waitproc
if gotsigchld is set but there is no outstanding child because
everything had been waited for previously without gotsigchld being
zeroed.

This patch fixes it by always zeroing gotsigchld as we did before.
The bug that the previous patch was trying to fix is now resolved
by switching the blocking mode to DOWAIT_NORMAL after the specified
job has been completed so that we really do wait for all outstanding
dead children.

Reported-by: Harald van Dijk <harald@gigawatt.nl>
Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
src/jobs.c