diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-10-13 15:43:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-10-13 17:19:31 +0200 |
commit | 08073121d8171f8e6be27b0c80e2ec283064760e (patch) | |
tree | cf54a42e258cbd87c64d4269613b82615236c4c3 /src/systemctl | |
parent | 2fc9a280cc47f455e7dffd3c4321da3f8ab65a58 (diff) |
systemctl: when mangle unit names for the "isolate", suffix with ".target" rather than ".service" by default
After all, we set AllowIsolate exclusively for target units so far, and
this is more or less the only thing tht makes sense, hence also use
".target" as completion suffix by default.
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 842ca6ceb8..af3cc97911 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2704,7 +2704,7 @@ static enum action verb_to_action(const char *verb) { static int start_unit(sd_bus *bus, char **args) { _cleanup_set_free_free_ Set *s = NULL; _cleanup_strv_free_ char **names = NULL; - const char *method, *mode, *one_name; + const char *method, *mode, *one_name, *suffix = NULL; char **name; int r = 0; @@ -2717,8 +2717,11 @@ static int start_unit(sd_bus *bus, char **args) { method = verb_to_method(args[0]); action = verb_to_action(args[0]); - mode = streq(args[0], "isolate") ? "isolate" : - action_table[action].mode ?: arg_job_mode; + if (streq(args[0], "isolate")) { + mode = "isolate"; + suffix = ".target"; + } else + mode = action_table[action].mode ?: arg_job_mode; one_name = action_table[action].target; } else { @@ -2734,7 +2737,7 @@ static int start_unit(sd_bus *bus, char **args) { if (one_name) names = strv_new(one_name, NULL); else { - r = expand_names(bus, args + 1, NULL, &names); + r = expand_names(bus, args + 1, suffix, &names); if (r < 0) log_error("Failed to expand names: %s", strerror(-r)); } |