summaryrefslogtreecommitdiffstats
path: root/src/systemctl
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-02-13 16:14:31 +0100
committerDave Reisner <dreisner@archlinux.org>2014-02-13 16:14:31 +0100
commit5a1aece58142023d407afae797bb0ffb05b34732 (patch)
tree34b18011e4b452f67dfad0707a91f560e5d75714 /src/systemctl
parenteverywhere: always use O_CLOEXEC where it makes sense (diff)
downloadsystemd-5a1aece58142023d407afae797bb0ffb05b34732.tar.xz
systemd-5a1aece58142023d407afae797bb0ffb05b34732.zip
systemctl: fix exit statuses from is-active/is-failed
This was inadvertantly disturbed in e3e0314b when glob support was added.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index edd4daaa24..ef0cbc5bf4 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2511,14 +2511,16 @@ static int start_special(sd_bus *bus, char **args) {
static int check_unit_generic(sd_bus *bus, int code, const char *good_states, char **args) {
_cleanup_strv_free_ char **names = NULL;
char **name;
- int r = code;
+ int r;
assert(bus);
assert(args);
r = expand_names(bus, args, NULL, &names);
- if (r < 0)
+ if (r < 0) {
log_error("Failed to expand names: %s", strerror(-r));
+ return r;
+ }
STRV_FOREACH(name, names) {
int state;
@@ -2526,8 +2528,8 @@ static int check_unit_generic(sd_bus *bus, int code, const char *good_states, ch
state = check_one_unit(bus, *name, good_states, arg_quiet);
if (state < 0)
return state;
- if (state > 0)
- r = 0;
+ if (state == 0)
+ r = code;
}
return r;