From a2c5887e51c3f676996f04bc860ccc96453d6076 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 12 Nov 2014 12:44:14 +0100 Subject: [PATCH] Fix crash when daemonizing Icinga refs #7648 --- lib/base/application.cpp | 4 ++-- lib/cli/daemoncommand.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index fe6512185..786cda166 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -223,7 +223,7 @@ void Application::SetResourceLimits(void) if (!new_argv) { perror("malloc"); - exit(1); + Exit(EXIT_FAILURE); } new_argv[0] = argv[0]; @@ -242,7 +242,7 @@ void Application::SetResourceLimits(void) if (execvp(new_argv[0], new_argv) < 0) perror("execvp"); - exit(1); + Exit(EXIT_FAILURE); } # else /* RLIMIT_STACK */ Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)"); diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 3a58e38d6..c2aed84fa 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -190,14 +190,14 @@ static bool Daemonize(void) if (ret == pid) { Log(LogCritical, "cli", "The daemon could not be started. See log output for details."); - exit(EXIT_FAILURE); + Application::Exit(EXIT_FAILURE); } else if (ret == -1) { Log(LogCritical, "cli") << "waitpid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; - exit(EXIT_FAILURE); + Application::Exit(EXIT_FAILURE); } - exit(0); + Application::Exit(0); } #endif /* _WIN32 */