From 6b9c8755c675ac60ed04b7b3bc16b8b747f48d1e Mon Sep 17 00:00:00 2001 From: Marcos Mello Date: Tue, 8 Jan 2019 10:14:09 +0000 Subject: [PATCH] Bug 4856: Exit when GoIntoBackground() fork() call fails (#344) Ignoring the (implicit/default) command-line instruction to background Squid is wrong in general and confuses at least some daemon managers. --- src/main.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.cc b/src/main.cc index 85fe8136b9..d9f423ed67 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 -- 2.47.2