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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user