]> granicus.if.org Git - icinga2/commitdiff
Fix S_ISDIR on Windows
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 3 Aug 2015 08:17:12 +0000 (10:17 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 3 Aug 2015 13:13:45 +0000 (15:13 +0200)
fixes #9813

lib/remote/configmoduleutility.cpp

index feac2bc0a78dbb473cb00fbbf54a3235ca2bbaea..7e87507cc24f9f08f1719913061b3afd7ca5d9ce 100644 (file)
@@ -262,6 +262,8 @@ void ConfigModuleUtility::CollectPaths(const String& path, std::vector<std::pair
                    << boost::errinfo_api_function("lstat")
                    << boost::errinfo_errno(errno)
                    << boost::errinfo_file_name(path));
+
+       paths.push_back(std::make_pair(path, S_ISDIR(statbuf.st_mode)));
 #else /* _WIN32 */
        struct _stat statbuf;
        int rc = _stat(path.CStr(), &statbuf);
@@ -270,9 +272,9 @@ void ConfigModuleUtility::CollectPaths(const String& path, std::vector<std::pair
                    << boost::errinfo_api_function("_stat")
                    << boost::errinfo_errno(errno)
                    << boost::errinfo_file_name(path));
-#endif /* _WIN32 */
 
-       paths.push_back(std::make_pair(path, S_ISDIR(statbuf.st_mode)));
+       paths.push_back(std::make_pair(path, ((statbuf.st_mode & S_IFMT) == S_IFDIR)));
+#endif /* _WIN32 */
 }
 
 bool ConfigModuleUtility::ContainsDotDot(const String& path)