From: Marcos Mello Date: Tue, 8 Jan 2019 10:14:09 +0000 (+0000) Subject: Bug 4856: Exit when GoIntoBackground() fork() call fails (#344) X-Git-Tag: M-staged-PR348~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b9c8755c675ac60ed04b7b3bc16b8b747f48d1e;p=thirdparty%2Fsquid.git 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. --- 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