Calling enable on template units doesn't make sense since it is possible to enable instances directly and users are not forced to use Alias= trickery anymore. --- src/shared/install.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c index 07e06c4..5cda794 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1470,9 +1470,11 @@ int unit_file_enable( _cleanup_lookup_paths_free_ LookupPaths paths = {}; _cleanup_install_context_done_ InstallContext c = {}; - char **i; + InstallInfo *v; + char **i, *k; _cleanup_free_ char *config_path = NULL; int r; + Iterator j; assert(scope >= 0); assert(scope < _UNIT_FILE_SCOPE_MAX); @@ -1491,6 +1493,12 @@ int unit_file_enable( return r; } + HASHMAP_FOREACH_KEY(v, k, c.will_install, j) { + r = unit_name_is_valid(k, false); + if (!r) + return -EINVAL; + } + /* This will return the number of symlink rules that were supposed to be created, not the ones actually created. This is useful to determine whether the passed files had any @@ -1509,10 +1517,12 @@ int unit_file_disable( _cleanup_lookup_paths_free_ LookupPaths paths = {}; _cleanup_install_context_done_ InstallContext c = {}; - char **i; + InstallInfo *v; + char **i, *k; _cleanup_free_ char *config_path = NULL; _cleanup_set_free_free_ Set *remove_symlinks_to = NULL; int r, q; + Iterator j; assert(scope >= 0); assert(scope < _UNIT_FILE_SCOPE_MAX); @@ -1531,6 +1541,12 @@ int unit_file_disable( return r; } + HASHMAP_FOREACH_KEY(v, k, c.will_install, j) { + r = unit_name_is_valid(k, false); + if (!r) + return -EINVAL; + } + r = install_context_mark_for_removal(&c, &paths, &remove_symlinks_to, config_path, root_dir); q = remove_marked_symlinks(remove_symlinks_to, config_path, changes, n_changes, files); -- 1.8.3.1 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel