From: Gunnar Beutner Date: Mon, 2 Jul 2012 09:04:20 +0000 (+0200) Subject: Check whether file was successfully opened. X-Git-Tag: v0.0.1~338 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b1de189be0ca5d356cb0b90a3b2c184f7a0eb0f;p=icinga2 Check whether file was successfully opened. --- diff --git a/dyn/configcompiler.cpp b/dyn/configcompiler.cpp index ca572cb6c..e94de6301 100644 --- a/dyn/configcompiler.cpp +++ b/dyn/configcompiler.cpp @@ -70,6 +70,9 @@ vector 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);