[svn] commit: r3396 - /trunk/src/bin/bind10/bind10.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 29 09:51:01 UTC 2010


Author: shane
Date: Fri Oct 29 09:51:01 2010
New Revision: 3396

Log:
Use setpgrp() so that we don't get SIGINT (Ctrl-C) on the child 
processes in BIND 10.

This is Trac ticket #378:

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

Small enough change that no ChangeLog entry added.

Modified:
    trunk/src/bin/bind10/bind10.py.in   (contents, props changed)

Modified: trunk/src/bin/bind10/bind10.py.in
==============================================================================
--- trunk/src/bin/bind10/bind10.py.in (original)
+++ trunk/src/bin/bind10/bind10.py.in Fri Oct 29 09:51:01 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