From bd9fe5b471063353dd89cbd70facb4db61c0c980 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Wed, 30 Mar 2011 14:50:00 -0600 Subject: [PATCH] Do not send signals from the master process to parent on shutdown. Trunk r11330 introduced a bug: When running in non-daemon mode, Squid sends SIGUSR1 signal to the parent process on shutdown. This results in shell (at least zsh) exit when Squid is interrupted with C-c. The patch adds a check to prevent the master process from killing it's parent on shutdown. Same check added for the kill-parent hack. --- src/main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index ffc2332068..8966c83e5b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -617,7 +617,7 @@ shut_down(int sig) const pid_t ppid = getppid(); - if (ppid > 1) { + if (!IamMasterProcess() && ppid > 1) { // notify master that we are shutting down if (kill(ppid, SIGUSR1) < 0) debugs(1, DBG_IMPORTANT, "Failed to send SIGUSR1 to master process," @@ -627,7 +627,7 @@ shut_down(int sig) #ifndef _SQUID_MSWIN_ #if KILL_PARENT_OPT - if (ppid > 1) { + if (!IamMasterProcess() && ppid > 1) { debugs(1, DBG_IMPORTANT, "Killing master process, pid " << ppid); if (kill(ppid, sig) < 0) -- 2.47.3