Skip to content

Commit 2005e4b

Browse files
committed
Merge branch 'bugfix/fork-exit' into feature/icinga-check-output-error-last-reload-failed-7263
2 parents 0af2a51 + 96ee6f1 commit 2005e4b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/cli/daemoncommand.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,17 @@ static pid_t StartUnixWorker(const std::vector<std::string>& configs, bool close
467467
case -1:
468468
Log(LogCritical, "cli")
469469
<< "fork() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
470-
exit(EXIT_FAILURE);
470+
471+
try {
472+
Application::InitializeBase();
473+
} catch (const std::exception& ex) {
474+
Log(LogCritical, "cli")
475+
<< "Failed to re-initialize thread pool after forking (parent): " << DiagnosticInformation(ex);
476+
exit(EXIT_FAILURE);
477+
}
478+
479+
(void)sigprocmask(SIG_UNBLOCK, &l_UnixWorkerSignals, nullptr);
480+
return -1;
471481

472482
case 0:
473483
try {

0 commit comments

Comments
 (0)