summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-03-08 09:00:00 +0100
committerDmitry V. Levin <ldv@strace.io>2023-03-08 19:55:40 +0100
commitb27e5e2aca6dcc97826399993fc5423d84585283 (patch)
tree33b6f3a7939d00b1f140991c24e7d537a2a08b05 /src/udev/udev-rules.c
parenttest: check udevadm verify diagnostics of unused labels (diff)
downloadsystemd-b27e5e2aca6dcc97826399993fc5423d84585283.tar.xz
systemd-b27e5e2aca6dcc97826399993fc5423d84585283.zip
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/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c5
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;
}