[svn] commit: r3253 - /branches/trac378/src/bin/bind10/bind10.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 18 11:33:44 UTC 2010


Author: shane
Date: Mon Oct 18 11:33:44 2010
New Revision: 3253

Log:
Change to shield child processes in BIND 10 from Ctrl-C.

See Trac ticket #378 for more details:

https://bind10.isc.org/ticket/378


Modified:
    branches/trac378/src/bin/bind10/bind10.py.in

Modified: branches/trac378/src/bin/bind10/bind10.py.in
==============================================================================
--- branches/trac378/src/bin/bind10/bind10.py.in (original)
+++ branches/trac378/src/bin/bind10/bind10.py.in Mon Oct 18 11:33:44 2010
@@ -141,9 +141,14 @@
         self.username = username
         self._spawn()
 
-    def _setuid(self):
+    def _preexec_work(self):
         """Function used before running a program that needs to run as a
         different user."""
+        # First, put us into a separate process group so we don't get
+        # SIGINT signals on Ctrl-C (the boss will shut everthing down by
+        # other means).
+        os.setpgrp()
+        # Second, set the user ID if one has been specified
         if self.uid is not None:
             try:
                 posix.setuid(self.uid)
@@ -177,7 +182,7 @@
                                         stderr=spawn_stderr,
                                         close_fds=True,
                                         env=spawn_env,
-                                        preexec_fn=self._setuid)
+                                        preexec_fn=self._preexec_work)
         self.pid = self.process.pid
         self.restart_schedule.set_run_start_time()
 




More information about the bind10-changes mailing list