]> granicus.if.org Git - icinga2/commitdiff
config: Make sure we're not inside a comment when reaching the end of a config file.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 9 Oct 2013 06:56:28 +0000 (08:56 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 9 Oct 2013 06:56:28 +0000 (08:56 +0200)
Fixes #4821

lib/config/config_lexer.ll

index d2d95f4370d1f7fa6c8c9ad0148c69f86045abb0..6729d966e638ce02dab0953d9f7ff52788ca63d7 100644 (file)
@@ -183,6 +183,14 @@ static char *lb_steal(lex_buf *lb)
 "*"                            /* ignore star */
 }
 
+<C_COMMENT><<EOF>>              {
+               std::ostringstream msgbuf;
+               msgbuf << "End-of-file while in comment: " << yytext << " " << *yylloc;
+               ConfigCompilerContext::GetInstance()->AddMessage(true, msgbuf.str());
+               yyterminate();
+                               }
+
+
 \/\/[^\n]*                     /* ignore C++-style comments */
 [ \t\r\n]                      /* ignore whitespace */