]> granicus.if.org Git - icinga2/commitdiff
Add exceptions for Utility::MkDir{,P}
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 21 Jul 2015 13:56:57 +0000 (15:56 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 21 Jul 2015 13:56:57 +0000 (15:56 +0200)
fixes #9689

lib/base/utility.cpp

index 177b67b325eb4290ef3778c3be5ba1e7d5d397f1..0c4161140e06b040ad66053f9377e46e9af08687 100644 (file)
@@ -559,8 +559,9 @@ bool Utility::MkDir(const String& path, int flags)
 #else /*_ WIN32 */
        if (mkdir(path.CStr()) < 0 && errno != EEXIST) {
 #endif /* _WIN32 */
-               //TODO handle missing dirs properly
-               return false;
+               BOOST_THROW_EXCEPTION(posix_error()
+                   << boost::errinfo_api_function("mkdir")
+                   << boost::errinfo_errno(errno));
        }
 
        return true;