Commit 99f0a885 authored by Shane Kerr's avatar Shane Kerr
Browse files

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.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3396 e5f2f494-b856-4b98-b285-d166d9295462
parent b44f0542
......@@ -141,9 +141,14 @@ class ProcessInfo:
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 @@ class ProcessInfo:
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment