diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-03-08 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-03-08 18:55:40 +0000 |
commit | b27e5e2aca6dcc97826399993fc5423d84585283 (patch) | |
tree | 33b6f3a7939d00b1f140991c24e7d537a2a08b05 /src/udev | |
parent | 5040401b43b7a3fe3dd372410ae4e3966ddb5d29 (diff) | |
download | systemd-b27e5e2aca6dcc97826399993fc5423d84585283.tar.gz |
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.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-rules.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 21223e0118..9d831a6004 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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; } |