From f1509d2f108bcfb2f5292383dfbad620568df0d8 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 2 Mar 2015 09:41:18 +0100 Subject: [PATCH] Fix uninitialized variable in DaemonUtility::ValidateConfigFiles Coverity bug ID: 1272330 --- lib/cli/daemonutility.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/cli/daemonutility.cpp b/lib/cli/daemonutility.cpp index 48600e1df..7997366b7 100644 --- a/lib/cli/daemonutility.cpp +++ b/lib/cli/daemonutility.cpp @@ -72,8 +72,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector& configs, ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile); if (!configs.empty()) { - BOOST_FOREACH(const String& configPath, configs) - { + BOOST_FOREACH(const String& configPath, configs) { Expression *expression = ConfigCompiler::CompileFile(configPath); success = ExecuteExpression(expression); delete expression; @@ -84,21 +83,24 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector& configs, /* Load cluster config files - this should probably be in libremote but * unfortunately moving it there is somewhat non-trivial. */ + success = true; + String zonesEtcDir = Application::GetZonesDir(); if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir)) Utility::Glob(zonesEtcDir + "/*", boost::bind(&IncludeZoneDirRecursive, _1, boost::ref(success)), GlobDirectory); + if (!success) return false; String zonesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones"; if (Utility::PathExists(zonesVarDir)) Utility::Glob(zonesVarDir + "/*", boost::bind(&IncludeNonLocalZone, _1, boost::ref(success)), GlobDirectory); + if (!success) return false; String name, fragment; - BOOST_FOREACH(boost::tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) - { + BOOST_FOREACH(boost::tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) { Expression *expression = ConfigCompiler::CompileText(name, fragment); success = ExecuteExpression(expression); delete expression; -- 2.40.0