From d80a9042cada88bc2ad2726de104292b2fd7ce57 Mon Sep 17 00:00:00 2001 From: PavlNekrasov <95914807+PavlNekrasov@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:17:21 +0300 Subject: [PATCH] Use correct error code in log message in output_waiting_jobs (#34404) The error code `r` from the read function is being logged, but the error code `rc` from the table data insertion function should be logged instead. --- src/systemctl/systemctl-list-jobs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemctl-list-jobs.c b/src/systemctl/systemctl-list-jobs.c index 2fecf61317..44054fda00 100644 --- a/src/systemctl/systemctl-list-jobs.c +++ b/src/systemctl/systemctl-list-jobs.c @@ -28,17 +28,16 @@ static int output_waiting_jobs(sd_bus *bus, Table *table, uint32_t id, const cha while ((r = sd_bus_message_read(reply, "(usssoo)", &other_id, &name, &type, NULL, NULL, NULL)) > 0) { _cleanup_free_ char *row = NULL; - int rc; if (asprintf(&row, "%s %u (%s/%s)", prefix, other_id, name, type) < 0) return log_oom(); - rc = table_add_many(table, + r = table_add_many(table, TABLE_STRING, special_glyph(SPECIAL_GLYPH_TREE_RIGHT), TABLE_STRING, row, TABLE_EMPTY, TABLE_EMPTY); - if (rc < 0) + if (r < 0) return table_log_add_error(r); }