]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: avoid logging 2 error messages if table_print_with_pager() fails
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Thu, 28 Aug 2025 12:09:50 +0000 (14:09 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Sep 2025 10:10:48 +0000 (12:10 +0200)
`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
src/analyze/analyze-capability.c
src/analyze/analyze-exit-status.c
src/analyze/analyze-pcrs.c
src/analyze/analyze-security.c
src/import/importctl.c
src/journal/journalctl-misc.c
src/pcrlock/pcrlock.c
src/userdb/userdbctl.c

index 2d155d57c1fcff10fa0af25d0c1ee1387f992ddf..d3cbaddf8d361f1b13aa3f2dc141094bcac067a7 100644 (file)
@@ -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;
 }
index 3e9b918ed4fdeae7b4ff4a63e31783987f7d2fcb..2b85d97c591ed747d41af8bc4f331ff4d9396ca2 100644 (file)
@@ -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;
 }
index 1032f1a4b7af4e7cd3a85113e0cc6f52879fd5eb..f469651bd94987d4bfa1e40833fdfb2920de4bb7 100644 (file)
@@ -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;
 }
index 0848f8e5b491d72f10a43766fc24596364830432..c3dc9cbe3213ff8762d8478459fe26ac155bbab7 100644 (file)
@@ -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;
 }
index aefd4f6122eb6654a794a644f73e79bedeb2b514..a0f04fdf69f03529e7f04b3e25f1df1e396ddfbd 100644 (file)
@@ -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;
 }
index 1ddba76b09cc0e631eee05043b47c2f71eb66cf9..d4a993b06d4f6dfd366293067046f1298f46a61b 100644 (file)
@@ -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) {
index 3dea69d9fb3dd5ea018afe68f542191909b112da..11dc77eb06618a0a71156cdd063106382902b3cf 100644 (file)
@@ -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;
 }
index f92d313377b330e6e8c915f17ae52d9a3b7f7773..73002c0bc731b7301c11dbd824df1a9c6cfd6950 100644 (file)
@@ -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)) {
index d295ca549520f1fbdbfd3b73a643e81b78db5347..b24ae0f7b3bda82911fdfdc8df3ab32828bae24f 100644 (file)
@@ -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) {