From 57402eedbc43e56a70d0746266d01547f58754a0 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sun, 18 Jun 2017 18:33:39 -0600 Subject: [PATCH] Polishing touches meant to be included in r15206. --- src/main.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index 4962964102..6f3e321f57 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1799,7 +1799,10 @@ masterSignaled() return (DebugSignal > 0 || RotateSignal > 0 || ReconfigureSignal > 0 || ShutdownSignal > 0); } -static void GoIntoBackground() +#if !_SQUID_WINDOWS_ +/// makes the caller a daemon process running in the background +static void +GoIntoBackground() { pid_t pid; if ((pid = fork()) < 0) { @@ -1810,14 +1813,15 @@ static void GoIntoBackground() // parent exit(EXIT_SUCCESS); } + // child, running as a background daemon (or a failed-to-fork parent) } +#endif /* !_SQUID_WINDOWS_ */ static void watch_child(char *argv[]) { #if !_SQUID_WINDOWS_ char *prog; - PidStatus status; pid_t pid; #ifdef TIOCNOTTY @@ -1945,6 +1949,7 @@ watch_child(char *argv[]) int waitFlag = 0; if (masterSignaled()) waitFlag = WNOHANG; + PidStatus status; pid = WaitForAnyPid(status, waitFlag); // check for a stopped kid -- 2.47.3