[PATCH] autotest: Avoid accumulating zombie children

YAMAMOTO Takashi <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
The issue has been seen with Open vSwitch testsuite.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 lib/autotest/general.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index b50a696..cdf453a 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1425,6 +1425,10 @@ dnl	    kill -13 $$
       echo >&AT_JOB_FIFO_OUT_FD
     ) &
     $at_job_control_off
+dnl With NetBSD /bin/sh, this loop can keep a zombie process for each
+dnl iterations. It can be a problem if at_jobs is large enough to hit
+dnl the ulimit. The following jobs command drains zombies as a side effect.
+    jobs > /dev/null || :  # drain the list of jobs
     if $at_first; then
       at_first=false
       exec AT_JOB_FIFO_IN_FD<"$at_job_fifo" AT_JOB_FIFO_OUT_FD>"$at_job_fifo"
-- 
2.5.4 (Apple Git-61)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.