diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-04-30 17:08:38 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-05-01 19:58:59 -0400 |
commit | 6597fa61173a16d9d93141a749badad67c4b4aa8 (patch) | |
tree | d2cb551341e6810649f721e513c6eadc51a8497b /src | |
parent | ce99c68a3362a2905743a0673a4c016f2b8ab1a6 (diff) |
shared/install: warn about DefaultInstance in non-template units
[/etc/systemd/system/mnt-test.mount:6] DefaultInstance only makes sense for template units, ignoring.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/install.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index cc39aaf677..f89e2c6387 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1003,6 +1003,7 @@ static int config_parse_default_instance( void *userdata) { UnitFileInstallInfo *i = data; + const char *name; char *printed; int r; @@ -1010,6 +1011,15 @@ static int config_parse_default_instance( assert(lvalue); assert(rvalue); + name = basename(filename); + if (unit_name_is_valid(name, UNIT_NAME_INSTANCE)) + /* When enabling an instance, we might be using a template unit file, + * but we should ignore DefaultInstance silently. */ + return 0; + if (!unit_name_is_valid(name, UNIT_NAME_TEMPLATE)) + return log_syntax(unit, LOG_WARNING, filename, line, 0, + "DefaultInstance only makes sense for template units, ignoring."); + r = install_full_printf(i, rvalue, &printed); if (r < 0) return r; |