]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Use correct error code in log message in output_waiting_jobs (#34404)
authorPavlNekrasov <95914807+PavlNekrasov@users.noreply.github.com>
Tue, 17 Sep 2024 10:17:21 +0000 (13:17 +0300)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2024 10:17:21 +0000 (19:17 +0900)
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

index 2fecf613179180e75834d635ddd91642b47e1528..44054fda007a06298a1f0983a8e80dd59ec06dac 100644 (file)
@@ -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);
         }