udev_rules_parse_file: issue diagnostics about line continuation at EOF

When udev rules file ends with a line continuation, the parser
used to silently ignore the line without any diagnostics at all.
It's time to break the vow of silence and let the parser issue some
error diagnostics.
This commit is contained in:
Dmitry V. Levin
2023-03-08 18:55:40 +00:00
parent 5040401b43
commit b27e5e2aca
2 changed files with 15 additions and 2 deletions
+5
View File
@@ -1279,6 +1279,7 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename) {
line_nr++;
line = skip_leading_chars(buf, NULL);
/* Lines beginning with '#' are ignored regardless of line continuation. */
if (line[0] == '#')
continue;
@@ -1320,6 +1321,10 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename) {
ignore_line = false;
}
if (continuation)
log_line_error(rule_file, line_nr,
"Unexpected EOF after line continuation, line ignored");
rule_resolve_goto(rule_file);
return 0;
}