diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-27 13:50:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-28 08:43:47 +0100 |
commit | e4086ae0b323cb17eacd7ed60ff5782f87baa4f2 (patch) | |
tree | 9cc454f50b52ba8a0cd741ddfb4b5f8cac458404 /src/shared/install.c | |
parent | install: use structured initializers (diff) | |
download | systemd-e4086ae0b323cb17eacd7ed60ff5782f87baa4f2.tar.xz systemd-e4086ae0b323cb17eacd7ed60ff5782f87baa4f2.zip |
install: when enabling a template unit without DefaultInstance= nor specified instance don't do anything
Previously, we'd link the unit file into /etc in this case, but that
should only be done if the unit file is not in the search path anyway,
and this is already done implicitly anyway for all enabled unit files,
hence no reason to duplicate this here.
Fixes: #10253
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 735e1f5b0e..28e07a23a5 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1752,12 +1752,16 @@ static int install_info_symlink_wants( if (strv_isempty(list)) return 0; - if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE) && i->default_instance) { + if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE)) { UnitFileInstallInfo instance = { .type = _UNIT_FILE_TYPE_INVALID, }; _cleanup_free_ char *path = NULL; + /* If this is a template, and we have no instance, don't do anything */ + if (!i->default_instance) + return 1; + r = unit_name_replace_instance(i->name, i->default_instance, &buf); if (r < 0) return r; |