summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2001-11-07 00:05:26 +0000
committerfenner <fenner@FreeBSD.org>2001-11-07 00:05:26 +0000
commita53b61e772f8606cd8a338c0298ccd3691135569 (patch)
treec6d3c8b17339540bc682d3596b3963c9c6fa8e95
parent140b89bb7704684c4efa5162eb0fdde1adcf3c2c (diff)
downloadFreeBSD-src-a53b61e772f8606cd8a338c0298ccd3691135569.zip
FreeBSD-src-a53b61e772f8606cd8a338c0298ccd3691135569.tar.gz
Don't ignore unknown characters. The previous code treated a line like:
hosts:!!!!!!!!@@@@@$%^&*()()*$(files{}{}|||++!)(dns exactly the same as: hosts: files dns Recover from parse errors by looking for the end of a line; this allows entries without errors to still be parsed even if there is an erroneous entry earlier in the file.
-rw-r--r--lib/libc/net/nslexer.l4
-rw-r--r--lib/libc/net/nsparser.y4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/net/nslexer.l b/lib/libc/net/nslexer.l
index 104cfbb..1166eed 100644
--- a/lib/libc/net/nslexer.l
+++ b/lib/libc/net/nslexer.l
@@ -94,9 +94,7 @@ STRING [a-zA-Z][a-zA-Z0-9_]*
return STRING;
}
-[:=\[\]] return yytext[0];
-
-. ; /* ignore all else */
+. return yytext[0];
%%
diff --git a/lib/libc/net/nsparser.y b/lib/libc/net/nsparser.y
index b39f011..79d5185 100644
--- a/lib/libc/net/nsparser.y
+++ b/lib/libc/net/nsparser.y
@@ -87,6 +87,10 @@ Entry
{
_nsdbtput(&curdbt);
}
+ | error NL
+ {
+ yyerrok;
+ }
;
Database
OpenPOWER on IntegriCloud