]> granicus.if.org Git - icinga2/commitdiff
Fix: include_recursive should gracefully handle inaccessible files
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 5 Jul 2016 13:40:49 +0000 (15:40 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 5 Jul 2016 13:40:49 +0000 (15:40 +0200)
fixes #12098

lib/config/configcompiler.cpp

index 7e76e9883c772faa0326e0625a8cae225c275073..209b1bd9b10f2c9d0fe8af0e30ac6cc0c2677140 100644 (file)
@@ -113,7 +113,14 @@ String ConfigCompiler::GetPackage(void) const
 void ConfigCompiler::CollectIncludes(std::vector<Expression *>& expressions,
     const String& file, const String& zone, const String& package)
 {
-       expressions.push_back(CompileFile(file, zone, package));
+       try {
+               Expression *expr = CompileFile(file, zone, package);
+               expressions.push_back(expr);
+       } catch (const std::exception& ex) {
+               Log(LogWarning, "ConfigCompiler")
+                   << "Cannot compile file '"
+                   << file << "': " << DiagnosticInformation(ex);
+       }
 }
 
 /**