]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not send signals from the master process to parent on shutdown.
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Wed, 30 Mar 2011 20:50:00 +0000 (14:50 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 30 Mar 2011 20:50:00 +0000 (14:50 -0600)
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

index ffc2332068004e986a5841a02047ed192bf063eb..8966c83e5b191cc5a1a2b3c3a41789e54ef2d9c0 100644 (file)
@@ -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)