Set CLOEXEC on the listening socket FD for the scheduler's status_server, so that child processes won't inherit the handle.

Signed-off-by: Steve Howard <showard@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2625 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/status_server.py b/scheduler/status_server.py
index 3d1c103..b49e932 100644
--- a/scheduler/status_server.py
+++ b/scheduler/status_server.py
@@ -1,4 +1,4 @@
-import os, BaseHTTPServer, cgi, threading, urllib
+import os, BaseHTTPServer, cgi, threading, urllib, fcntl
 import common
 from autotest_lib.scheduler import scheduler_config
 
@@ -92,6 +92,10 @@
         self._shutting_down = False
         self._drone_manager = drone_manager
 
+        # ensure the listening socket is not inherited by child processes
+        old_flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+        fcntl.fcntl(self.fileno(), fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)
+
 
     def shutdown(self):
         if self._shutting_down: