]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 8 Jan 2019 13:19:12 +0000 (13:19 +0000)
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 85fe8136b91c9f0f82dcd528634ce95a79b9ea6f..d9f423ed67dd568a8d3ded07b6c3508ea884010f 100644 (file)
@@ -1860,13 +1860,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