]> granicus.if.org Git - icinga2/commitdiff
Check whether file was successfully opened.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 2 Jul 2012 09:04:20 +0000 (11:04 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 2 Jul 2012 09:04:20 +0000 (11:04 +0200)
dyn/configcompiler.cpp

index ca572cb6c35f0df35bde2f39a83cb0678e53a42b..e94de6301c10942dbacd71cb94cc54b0d1f842e7 100644 (file)
@@ -70,6 +70,9 @@ vector<ConfigItem::Ptr> ConfigCompiler::CompileFile(const string& filename)
        stream.exceptions(ifstream::badbit);
        stream.open(filename.c_str(), ifstream::in);
 
+       if (!stream.good())
+               throw invalid_argument("Could not open config file: " + filename);
+
        Application::Log(LogInformation, "dyn", "Compiling config file: " + filename);
 
        return CompileStream(&stream);