From 4b6607d94933ff297b6893e4eb5cdc622cc97504 Mon Sep 17 00:00:00 2001 From: fangxiuning Date: Wed, 8 Jul 2020 15:16:52 +0800 Subject: [PATCH] table use table_log_print_error() instead of table_log_show_error --- src/busctl/busctl.c | 2 +- src/home/homectl.c | 2 +- src/id128/id128.c | 2 +- src/login/inhibit.c | 2 +- src/login/loginctl.c | 2 +- src/machine/machinectl.c | 2 +- src/mount/mount-tool.c | 2 +- src/network/networkctl.c | 10 +++++----- src/portable/portablectl.c | 2 +- src/resolve/resolvectl.c | 6 +++--- src/shared/format-table.h | 4 ++-- src/systemctl/systemctl.c | 2 +- src/timedate/timedatectl.c | 8 ++++---- src/userdb/userdbctl.c | 6 +++--- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index f6345888171..56fb8d93676 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -371,7 +371,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) { else r = table_print(table, stdout); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); return 0; } diff --git a/src/home/homectl.c b/src/home/homectl.c index 888e77bc4e8..33e262706d2 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -177,7 +177,7 @@ static int list_homes(int argc, char *argv[], void *userdata) { else r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } if (arg_legend && !arg_json) { diff --git a/src/id128/id128.c b/src/id128/id128.c index 13996573ab6..236043bf8a4 100644 --- a/src/id128/id128.c +++ b/src/id128/id128.c @@ -139,7 +139,7 @@ static int verb_show(int argc, char **argv, void *userdata) { if (table) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); } return 0; diff --git a/src/login/inhibit.c b/src/login/inhibit.c index d5f37d8dd81..e3866eee55a 100644 --- a/src/login/inhibit.c +++ b/src/login/inhibit.c @@ -138,7 +138,7 @@ static int print_inhibitors(sd_bus *bus) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } if (arg_legend) { diff --git a/src/login/loginctl.c b/src/login/loginctl.c index dd47ec381a5..2b48a9acb79 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -100,7 +100,7 @@ static int show_table(Table *table, const char *word) { else r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } if (arg_legend) { diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 7c3eaad842a..26fa48d870c 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -246,7 +246,7 @@ static int show_table(Table *table, const char *word) { else r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } if (arg_legend) { diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c index 13f8a37ddf2..84d5288c75e 100644 --- a/src/mount/mount-tool.c +++ b/src/mount/mount-tool.c @@ -1436,7 +1436,7 @@ static int list_devices(void) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); return 0; } diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 3b9da74e431..cc4639aeaf7 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -719,7 +719,7 @@ static int list_links(int argc, char *argv[], void *userdata) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); if (arg_legend) printf("\n%i links listed.\n", c); @@ -1064,7 +1064,7 @@ static int dump_address_labels(sd_netlink *rtnl) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); return 0; } @@ -2129,7 +2129,7 @@ static int link_status_one( r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); return show_logs(info); } @@ -2201,7 +2201,7 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); return show_logs(NULL); } @@ -2421,7 +2421,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); if (arg_legend) { lldp_capabilities_legend(all); diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 889e240ea75..aa6369864a4 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -750,7 +750,7 @@ static int list_images(int argc, char *argv[], void *userdata) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } if (arg_legend) { diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index b40f159c76d..c01524b9cc5 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -1079,7 +1079,7 @@ static int show_statistics(int argc, char **argv, void *userdata) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); return 0; } @@ -1519,7 +1519,7 @@ static int status_ifindex(sd_bus *bus, int ifindex, const char *name, StatusMode r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); if (empty_line) *empty_line = true; @@ -1760,7 +1760,7 @@ static int status_global(sd_bus *bus, StatusMode mode, bool *empty_line) { r = table_print(table, NULL); if (r < 0) - return log_error_errno(r, "Failed to print table: %m"); + return table_log_print_error(r); *empty_line = true; diff --git a/src/shared/format-table.h b/src/shared/format-table.h index d2fee3dbddc..1851f1d14a2 100644 --- a/src/shared/format-table.h +++ b/src/shared/format-table.h @@ -131,8 +131,8 @@ int table_print_json(Table *t, FILE *f, JsonFormatFlags json_flags); #define table_log_add_error(r) \ log_error_errno(r, "Failed to add cell(s) to table: %m") -#define table_log_show_error(r) \ - log_error_errno(r, "Failed to show table: %m") +#define table_log_print_error(r) \ + log_error_errno(r, "Failed to print table: %m") #define table_log_sort_error(r) \ log_error_errno(r, "Failed to sort table: %m") diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 3933011c927..c58a19a099d 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -392,7 +392,7 @@ static int output_table(Table *table) { else r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); return 0; } diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 102ffece634..eaac3b3e355 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -160,7 +160,7 @@ static int print_status_info(const StatusInfo *i) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); if (i->rtc_local) printf("\n%s" @@ -433,7 +433,7 @@ static int print_ntp_status_info(NTPStatusInfo *i) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); return 0; } @@ -442,7 +442,7 @@ static int print_ntp_status_info(NTPStatusInfo *i) { log_error("Invalid NTP response"); r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); return 0; } @@ -526,7 +526,7 @@ static int print_ntp_status_info(NTPStatusInfo *i) { r = table_print(table, NULL); if (r < 0) - table_log_show_error(r); + return table_log_print_error(r); return 0; } diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index 55984518d07..c973ee9c011 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -180,7 +180,7 @@ static int display_user(int argc, char *argv[], void *userdata) { if (table) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } return ret; @@ -330,7 +330,7 @@ static int display_group(int argc, char *argv[], void *userdata) { if (table) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } return ret; @@ -463,7 +463,7 @@ static int display_memberships(int argc, char *argv[], void *userdata) { if (table) { r = table_print(table, NULL); if (r < 0) - return table_log_show_error(r); + return table_log_print_error(r); } return ret; -- 2.47.3