diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-09-19 08:15:07 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-09-19 08:27:34 +0200 |
commit | d39b034af6f9795c4f17a8ddd186f026bb74193c (patch) | |
tree | 4b16b852cf24b9a93f0bcf9e102f7954cf9e0ee1 /src/systemctl/systemctl.c | |
parent | 46eddbb597a379ef64a3ee76029ce625902e8107 (diff) |
systemctl: properly report success
Systemctl would always return 1, because it treated uninteresting dbus
messages ("job added") as errors. Just ignore everything apart from
interesting ("job removed") messages.
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 15c08668c8..729d4dd324 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1322,7 +1322,10 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) { return -ECONNREFUSED; } - if (!arg_quiet && d.result) { + if (!d.result) + goto free_name; + + if (!arg_quiet) { if (streq(d.result, "timeout")) log_error("Job for %s timed out.", strna(d.name)); else if (streq(d.result, "canceled")) @@ -1343,11 +1346,12 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) { free(d.result); d.result = NULL; + free_name: free(d.name); d.name = NULL; } - /* This is slightly dirty, since we don't undo the filter registration. */ + dbus_connection_remove_filter(bus, wait_filter, &d); return r; } |