]> granicus.if.org Git - icinga2/commitdiff
Fix Utility::MkDirP on Windows
authorGunnar Beutner <gunnar@beutner.name>
Tue, 29 Mar 2016 07:43:40 +0000 (09:43 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 29 Mar 2016 07:44:05 +0000 (09:44 +0200)
fixes #11455

lib/base/utility.cpp

index 2cf581fe07df5afc1392d761f08cd8edd3b03d5c..dfb0614db87e1d07d59d4ea52d4f2f4fae6c32bd 100644 (file)
@@ -726,7 +726,11 @@ void Utility::MkDirP(const String& path, int mode)
 #else /*_ WIN32 */
                pos = path.FindFirstOf("/\\", pos + 1);
 #endif /* _WIN32 */
-               MkDir(path.SubStr(0, pos), mode);
+
+               String spath = path.SubStr(0, pos + 1);
+               struct stat statbuf;
+               if (stat(spath.CStr(), &statbuf) < 0 && errno == ENOENT)
+                       MkDir(path.SubStr(0, pos), mode);
        }
 }