summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-29 11:14:49 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2016-12-29 11:14:49 +0100
commitbe70491622fe24b545195283dcd1d1a7f464bbb8 (patch)
tree01d837e5519f1740cdfb960845348eab91cb0e2b /src/shared
parent8dbf71ec58a6de42cbe5621384517364f9094534 (diff)
systemctl: permit "enable" and "add-wants" without any instances (#4992)
This permits "systemctl enable" and "systemctl add-wants" on template units without any specifications of an instance name, neither specified on the command line, nor specified in DefaultInstance= field of the [install] section. Fixes: #3473
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/install.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 474426d927..4e047157cc 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1567,18 +1567,12 @@ static int install_info_symlink_wants(
if (strv_isempty(list))
return 0;
- if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE)) {
+ if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE) && i->default_instance) {
UnitFileInstallInfo instance = {
.type = _UNIT_FILE_TYPE_INVALID,
};
_cleanup_free_ char *path = NULL;
- /* Don't install any symlink if there's no default
- * instance configured */
-
- if (!i->default_instance)
- return 0;
-
r = unit_name_replace_instance(i->name, i->default_instance, &buf);
if (r < 0)
return r;