mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Check whether file was successfully opened.
This commit is contained in:
parent
7d5ab3d890
commit
9b1de189be
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user