From: Gunnar Beutner Date: Tue, 29 Mar 2016 07:43:40 +0000 (+0200) Subject: Fix Utility::MkDirP on Windows X-Git-Tag: v2.5.0~444 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=016f47d6e6c23e177fe5a9dd37f8289fb0dba78b;p=icinga2 Fix Utility::MkDirP on Windows fixes #11455 --- diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 2cf581fe0..dfb0614db 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -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); } }