summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2015-09-18 11:56:53 +0200
committerJan Synacek <jsynacek@redhat.com>2015-09-21 10:05:49 +0200
commitac5e3a505e49c80b56c971a8fc13bacac961640d (patch)
treee3cae8e85e61140e2c4b983240ed7cff62c0ba90 /src/systemctl
parent8c710f3ce64110a4cfe977116c55bd87777e641c (diff)
core: extend KillUnit() to return error when no unit was killed
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d21ba9a566..d1e443b8a6 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3107,7 +3107,7 @@ static int check_unit_failed(sd_bus *bus, char **args) {
static int kill_unit(sd_bus *bus, char **args) {
_cleanup_strv_free_ char **names = NULL;
- char **name;
+ char *kill_who = NULL, **name;
int r, q;
assert(bus);
@@ -3118,6 +3118,10 @@ static int kill_unit(sd_bus *bus, char **args) {
if (!arg_kill_who)
arg_kill_who = "all";
+ /* --fail was specified */
+ if (streq(arg_job_mode, "fail"))
+ kill_who = strjoina(arg_kill_who, "-fail", NULL);
+
r = expand_names(bus, args + 1, NULL, &names);
if (r < 0)
log_error_errno(r, "Failed to expand names: %m");
@@ -3133,7 +3137,7 @@ static int kill_unit(sd_bus *bus, char **args) {
"KillUnit",
&error,
NULL,
- "ssi", *names, arg_kill_who, arg_signal);
+ "ssi", *names, kill_who ? kill_who : arg_kill_who, arg_signal);
if (q < 0) {
log_error("Failed to kill unit %s: %s", *names, bus_error_message(&error, q));
if (r == 0)