From f5db7fcce02c573725c0fe158ceb93035d3a5c2f Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Thu, 28 Aug 2025 14:09:50 +0200 Subject: [PATCH] tree-wide: avoid logging 2 error messages if table_print_with_pager() fails `table_print_with_pager()` already calls `table_log_print_error()` internally if there is an error. (cherry picked from commit 3eb590f2b0060b6f2c08632fa48c92b256ad3ba0) --- src/analyze/analyze-architectures.c | 2 +- src/analyze/analyze-capability.c | 2 +- src/analyze/analyze-exit-status.c | 2 +- src/analyze/analyze-pcrs.c | 2 +- src/analyze/analyze-security.c | 4 ++-- src/import/importctl.c | 4 ++-- src/journal/journalctl-misc.c | 2 +- src/pcrlock/pcrlock.c | 6 +++--- src/userdb/userdbctl.c | 8 ++++---- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/analyze/analyze-architectures.c b/src/analyze/analyze-architectures.c index 2d155d57c1f..d3cbaddf8d3 100644 --- a/src/analyze/analyze-architectures.c +++ b/src/analyze/analyze-architectures.c @@ -82,7 +82,7 @@ int verb_architectures(int argc, char *argv[], void *userdata) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; return EXIT_SUCCESS; } diff --git a/src/analyze/analyze-capability.c b/src/analyze/analyze-capability.c index 3e9b918ed4f..2b85d97c591 100644 --- a/src/analyze/analyze-capability.c +++ b/src/analyze/analyze-capability.c @@ -81,7 +81,7 @@ int verb_capabilities(int argc, char *argv[], void *userdata) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; return EXIT_SUCCESS; } diff --git a/src/analyze/analyze-exit-status.c b/src/analyze/analyze-exit-status.c index 1032f1a4b7a..f469651bd94 100644 --- a/src/analyze/analyze-exit-status.c +++ b/src/analyze/analyze-exit-status.c @@ -48,7 +48,7 @@ int verb_exit_status(int argc, char *argv[], void *userdata) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; return EXIT_SUCCESS; } diff --git a/src/analyze/analyze-pcrs.c b/src/analyze/analyze-pcrs.c index 0848f8e5b49..c3dc9cbe321 100644 --- a/src/analyze/analyze-pcrs.c +++ b/src/analyze/analyze-pcrs.c @@ -138,7 +138,7 @@ int verb_pcrs(int argc, char *argv[], void *userdata) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; return EXIT_SUCCESS; } diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c index aefd4f6122e..a0f04fdf69f 100644 --- a/src/analyze/analyze-security.c +++ b/src/analyze/analyze-security.c @@ -1880,7 +1880,7 @@ static int assess(const SecurityInfo *info, r = table_print_with_pager(details_table, json_format_flags, pager_flags, /* show_header= */true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; } exposure = DIV_ROUND_UP(badness_sum * 100U, weight_sum); @@ -2891,7 +2891,7 @@ static int analyze_security(sd_bus *bus, r = table_print_with_pager(overview_table, json_format_flags, pager_flags, /* show_header= */true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; } return ret; } diff --git a/src/import/importctl.c b/src/import/importctl.c index 1ddba76b09c..d4a993b06d4 100644 --- a/src/import/importctl.c +++ b/src/import/importctl.c @@ -848,7 +848,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) { if (!table_isempty(t)) { r = table_print_with_pager(t, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; } if (arg_legend) { @@ -967,7 +967,7 @@ static int list_images(int argc, char *argv[], void *userdata) { if (!table_isempty(t)) { r = table_print_with_pager(t, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; } if (arg_legend) { diff --git a/src/journal/journalctl-misc.c b/src/journal/journalctl-misc.c index 3dea69d9fb3..11dc77eb066 100644 --- a/src/journal/journalctl-misc.c +++ b/src/journal/journalctl-misc.c @@ -146,7 +146,7 @@ static int show_log_ids(const LogId *ids, size_t n_ids, const char *name) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, !arg_quiet); if (r < 0) - return table_log_print_error(r); + return r; return 0; } diff --git a/src/pcrlock/pcrlock.c b/src/pcrlock/pcrlock.c index f92d313377b..73002c0bc73 100644 --- a/src/pcrlock/pcrlock.c +++ b/src/pcrlock/pcrlock.c @@ -2185,7 +2185,7 @@ static int show_log_table(EventLog *el, sd_json_variant **ret_variant) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; return 0; } @@ -2346,7 +2346,7 @@ static int show_pcr_table(EventLog *el, sd_json_variant **ret_variant) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */ true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; if (!sd_json_format_enabled(arg_json_format_flags)) printf("\n" @@ -2657,7 +2657,7 @@ static int verb_list_components(int argc, char *argv[], void *userdata) { if (!table_isempty(table) || sd_json_format_enabled(arg_json_format_flags)) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */ true); if (r < 0) - return log_error_errno(r, "Failed to output table: %m"); + return r; } if (!sd_json_format_enabled(arg_json_format_flags)) { diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index d295ca54952..b24ae0f7b3b 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -494,7 +494,7 @@ static int display_user(int argc, char *argv[], void *userdata) { if (!table_isempty(table)) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return table_log_print_error(r); + return r; } if (arg_legend) { @@ -829,7 +829,7 @@ static int display_group(int argc, char *argv[], void *userdata) { if (!table_isempty(table)) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return table_log_print_error(r); + return r; } if (arg_legend) { @@ -978,7 +978,7 @@ static int display_memberships(int argc, char *argv[], void *userdata) { if (!table_isempty(table)) { r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return table_log_print_error(r); + return r; } if (arg_legend) { @@ -1043,7 +1043,7 @@ static int display_services(int argc, char *argv[], void *userdata) { if (!table_isempty(t)) { r = table_print_with_pager(t, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return table_log_print_error(r); + return r; } if (arg_legend && arg_output != OUTPUT_JSON) { -- 2.47.3