summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-11-17 08:20:01 +0100
committerGitHub <noreply@github.com>2016-11-17 08:20:01 +0100
commit375fd1559b8fd3ece42716af3b8d25bc46fbd6fa (patch)
tree15c577fe946633ac95b81b6b9d466b47dad77b2c /src/systemctl
parent4a58145f0f06970cc93377e034a9e27b3c0283ad (diff)
parent76d8ca22293d106dfece06df8102ff61ff55ca77 (diff)
Merge pull request #4681 from keszybz/shortening
Shortening
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index db836639b5..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;
- }
+ printf("%s %u (%s/%s)\n", prefix, other_id, name, type);
+ 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 {
@@ -2309,9 +2303,9 @@ static void output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned
on, state_len, j->state, off);
if (arg_jobs_after)
- output_waiting_jobs(bus, j->id, "GetJobAfter", "\tA job waits for this job: ");
+ output_waiting_jobs(bus, j->id, "GetJobAfter", "\twaiting for job");
if (arg_jobs_before)
- output_waiting_jobs(bus, j->id, "GetJobBefore", "\tThis job waits for a job: ");
+ output_waiting_jobs(bus, j->id, "GetJobBefore", "\tblocking job");
}
if (!arg_no_legend) {