]> granicus.if.org Git - icinga2/commitdiff
Fix error handling for FeatureUtility::GetFeatures
authorGunnar Beutner <gunnar@beutner.name>
Mon, 14 Mar 2016 07:45:12 +0000 (08:45 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 15 Mar 2016 12:15:01 +0000 (13:15 +0100)
fixes #11349

lib/cli/featureutility.cpp

index 4d5d869f006b562f72027294cf17281480a09dee..71845b2e8894db44a6f3254c93ec81d0202ad310 100644 (file)
@@ -197,30 +197,16 @@ int FeatureUtility::ListFeatures(std::ostream& os)
 
 bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disabled)
 {
-       String path;
-
        /* request all disabled features */
        if (get_disabled) {
                /* disable = available-enabled */
                String available_pattern = GetFeaturesAvailablePath() + "/*.conf";
                std::vector<String> available;
-
-               if (!Utility::Glob(available_pattern,
-                   boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile)) {
-                       Log(LogCritical, "cli")
-                           << "Cannot access path '" << path << "'.";
-                       return false;
-               }
+               Utility::Glob(available_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile);
 
                String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
                std::vector<String> enabled;
-
-               if (!Utility::Glob(enabled_pattern,
-                   boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile)) {
-                       Log(LogCritical, "cli")
-                           << "Cannot access path '" << path << "'.";
-                       return false;
-               }
+               Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile);
 
                std::sort(available.begin(), available.end());
                std::sort(enabled.begin(), enabled.end());
@@ -233,12 +219,7 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
                /* all enabled features */
                String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
 
-               if (!Utility::Glob(enabled_pattern,
-                   boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile)) {
-                       Log(LogCritical, "cli")
-                           << "Cannot access path '" << path << "'.";
-                       return false;
-               }
+               Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile);
        }
 
        return true;