summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2022-03-14 18:26:53 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2022-03-14 23:33:22 +0100
commit8e4b9a252b434b7f8c74271df8dc4f07d7960c32 (patch)
tree4ec883a1f478be952c8781da64ec83a4b79176a7 /src/journal/journalctl.c
parentfaf20d4cca04cb9d08d098d4d9748e493648703b (diff)
downloadsystemd-8e4b9a252b434b7f8c74271df8dc4f07d7960c32.tar.gz
journal: use table_set_json_field_name() to override a column name
Pointed out in: https://github.com/systemd/systemd/pull/22721#discussion_r826014227 Follow-up for: 5a1355d848a0f6564a04c6d8268e72bc93d173de
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index e0951f9682..55c48eded5 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1460,13 +1460,17 @@ static int list_boots(sd_journal *j) {
if (count == 0)
return count;
- table = table_new(OUTPUT_MODE_IS_JSON(arg_output) ? "index" : "idx", "boot id", "first entry", "last entry");
+ table = table_new("idx", "boot id", "first entry", "last entry");
if (!table)
return log_oom();
if (arg_full)
table_set_width(table, 0);
+ r = table_set_json_field_name(table, 0, "index");
+ if (r < 0)
+ return log_error_errno(r, "Failed to set JSON field name of column 0: %m");
+
i = 0;
LIST_FOREACH(boot_list, id, all_ids) {
r = table_add_many(table,