Fix a race in autotestd_monitor that occasionally comes up during
termination. It's possible for the initial SIGTERM -> std* tails
to lead to a SIGCHLD to the original autotestd_monitor before it
cleanly exits. Once it's ready to terminate the monitor should instead
clear the SIGCHLD handler before SIGTERMing its children.

Risk: Low
Visibility: Fix a race in autotestd_monitor that occasionally
caused spurious autotest client failures.

Signed-off-by: John Admanski <jadmanski@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@3347 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotestd_monitor b/client/bin/autotestd_monitor
index f681863..a3217af 100755
--- a/client/bin/autotestd_monitor
+++ b/client/bin/autotestd_monitor
@@ -47,7 +47,10 @@
     fcntl.flock(exit_code_file, fcntl.LOCK_UN)
     exit_code_file.close()
 
-time.sleep(2) # tail runs in 1s polling loop, so give them a chance to finish
+# tail runs in 1s polling loop, so give them a chance to finish
+time.sleep(2)
+# clear the SIGCHLD handler so that killing the tails doesn't kill us
+signal.signal(signal.SIGCHLD, signal.SIG_DFL)
 os.kill(stdout_pump.pid, signal.SIGTERM)
 os.kill(stderr_pump.pid, signal.SIGTERM)