summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-11-22 11:59:11 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-11-25 16:45:29 +0100
commitf4331d0db28c75d70f2e8e0c06cc84e5909b4088 (patch)
tree1d069f3e3c104eaa7df7f412f83a8420bbfc9529
parent130b812f9d682e8dc8b3b85fd58077b3caf0da8e (diff)
downloadsystemd-f4331d0db28c75d70f2e8e0c06cc84e5909b4088.tar.gz
shared/install: warn about unkown sections in unit files
As in the previous commit, ignoring unkown sections means users may be confused easily. It is better to warn about misspellt section names. In this case, we are using a separate item table, so we'd ignore all those sections anyway, so we could list them with out the minus prefixes and the effect would be the same. But I think it's clearer to prefix them.
-rw-r--r--src/shared/install.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 14dfd331d5..5680660928 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1290,9 +1290,21 @@ static int unit_file_load(
assert(c);
r = config_parse(info->name, path, f,
- NULL,
+ "Install\0"
+ "-Unit\0"
+ "-Automount\0"
+ "-Device\0"
+ "-Mount\0"
+ "-Path\0"
+ "-Scope\0"
+ "-Service\0"
+ "-Slice\0"
+ "-Socket\0"
+ "-Swap\0"
+ "-Target\0"
+ "-Timer\0",
config_item_table_lookup, items,
- CONFIG_PARSE_RELAXED|CONFIG_PARSE_ALLOW_INCLUDE, info);
+ CONFIG_PARSE_ALLOW_INCLUDE, info);
if (r < 0)
return log_debug_errno(r, "Failed to parse %s: %m", info->name);