summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-16 21:01:11 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-16 21:01:11 -0500
commit76d8ca22293d106dfece06df8102ff61ff55ca77 (patch)
tree3a9f7fadb16d23d40977fe633dd9af9fc69b49ab /src/systemctl/systemctl.c
parentbc357ce5d7848cd43ed9e3c75c15c02a8873f095 (diff)
core/dbus-job, systemctl: shorten some code
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 5fbda23775..4fd8d7ba27 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2197,7 +2197,7 @@ finish:
return r;
}
-static void output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, const char *prefix) {
+static int output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, const char *prefix) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
const char *name, *type, *state, *job_path, *unit_path;
@@ -2215,29 +2215,23 @@ static void output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, co
&error,
&reply,
"u", id);
- if (r < 0) {
- log_debug_errno(r, "Failed to get waiting jobs for job %" PRIu32, id);
- return;
- }
+ if (r < 0)
+ return log_debug_errno(r, "Failed to get waiting jobs for job %" PRIu32, id);
r = sd_bus_message_enter_container(reply, 'a', "(usssoo)");
- if (r < 0) {
- bus_log_parse_error(r);
- return;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(usssoo)", &other_id, &name, &type, &state, &job_path, &unit_path)) > 0)
printf("%s %u (%s/%s)\n", prefix, other_id, name, type);
- if (r < 0) {
- bus_log_parse_error(r);
- return;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
r = sd_bus_message_exit_container(reply);
- if (r < 0) {
- bus_log_parse_error(r);
- return;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ return 0;
}
struct job_info {