]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4856: Exit when GoIntoBackground() fork() call fails (#344)
authorMarcos Mello <marcosfrm@users.noreply.github.com>
Tue, 8 Jan 2019 10:14:09 +0000 (10:14 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Mon, 28 Jan 2019 05:11:46 +0000 (18:11 +1300)
Ignoring the (implicit/default) command-line instruction to background
Squid is wrong in general and confuses at least some daemon managers.

src/main.cc

index eeb8f72bcb3b3db665fd7744047af7118a666b86..7f5ec8015f2bd0a128a46375fa5c521c7910b79a 100644 (file)
@@ -1865,13 +1865,12 @@ GoIntoBackground()
     pid_t pid;
     if ((pid = fork()) < 0) {
         int xerrno = errno;
-        syslog(LOG_ALERT, "fork failed: %s", xstrerr(xerrno));
-        // continue anyway, mimicking --foreground mode (XXX?)
+        throw TexcHere(ToSBuf("failed to fork(2) the master process: ", xstrerr(xerrno)));
     } else if (pid > 0) {
         // parent
         exit(EXIT_SUCCESS);
     }
-    // child, running as a background daemon (or a failed-to-fork parent)
+    // child, running as a background daemon
 }
 
 static void