From: Jean Flach Date: Wed, 21 Jan 2015 15:16:47 +0000 (+0100) Subject: Fix an Icinga crash, improve a log message X-Git-Tag: v2.3.0~357 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0483490c8521da8bd872878d4ad73f92402aa6d;p=icinga2 Fix an Icinga crash, improve a log message fixes #8227 --- diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index d7d3a8608..2389a2263 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -256,7 +256,7 @@ int Main(void) logLevel = Logger::StringToSeverity(severity); } catch (std::exception&) { /* Inform user and exit */ - Log(LogCritical, "icinga", "Invalid log level set. Default is 'information'."); + Log(LogCritical, "icinga-app", "Invalid log level set. Default is 'information'."); return EXIT_FAILURE; } @@ -264,10 +264,26 @@ int Main(void) } if (vm.count("library")) { - BOOST_FOREACH(const String& libraryName, vm["library"].as >()) { - (void)Utility::LoadExtensionLibrary(libraryName); + BOOST_FOREACH(const String& libraryName, vm["library"].as >()) + { + try { + (void)Utility::LoadExtensionLibrary(libraryName); + } +#ifdef _WIN32 + catch (win32_error &ex) { + if (int const * err = boost::get_error_info(ex)) { + Log(LogCritical, "icinga-app", "Could not load library \"" + libraryName + "\""); + exit(EXIT_FAILURE); + } + } +#else /*_WIN32*/ + catch (std::runtime_error &ex) { + Log(LogCritical, "icinga-app", "Could not load library \"" + libraryName + "\""); + exit(EXIT_FAILURE); + } +#endif /*_WIN32*/ } - } + } if (!command || vm.count("help") || vm.count("version")) { String appName = Utility::BaseName(Application::GetArgV()[0]);