diff options
author | fangxiuning <fangxiuning123@126.com> | 2020-07-07 10:13:13 +0800 |
---|---|---|
committer | fangxiuning <fangxiuning123@126.com> | 2020-07-08 10:50:59 +0800 |
commit | d836018a73bc0cc9c1525aea0706e56213589a70 (patch) | |
tree | 1966231107e46c70288a305f25847d83ee9cbed3 | |
parent | f987a261b460bfdaaa6f5375a7e277772d4096cd (diff) | |
download | systemd-d836018a73bc0cc9c1525aea0706e56213589a70.tar.gz |
table add table_log_show_error()
-rw-r--r-- | src/busctl/busctl.c | 2 | ||||
-rw-r--r-- | src/home/homectl.c | 2 | ||||
-rw-r--r-- | src/login/inhibit.c | 2 | ||||
-rw-r--r-- | src/login/loginctl.c | 2 | ||||
-rw-r--r-- | src/machine/machinectl.c | 2 | ||||
-rw-r--r-- | src/portable/portablectl.c | 2 | ||||
-rw-r--r-- | src/shared/format-table.h | 3 | ||||
-rw-r--r-- | src/systemctl/systemctl.c | 2 | ||||
-rw-r--r-- | src/timedate/timedatectl.c | 8 | ||||
-rw-r--r-- | src/userdb/userdbctl.c | 6 |
10 files changed, 17 insertions, 14 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index 3ab90de63e..f634588817 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); return 0; } diff --git a/src/home/homectl.c b/src/home/homectl.c index 149f960f76..b5ad9d53d0 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } if (arg_legend && !arg_json) { diff --git a/src/login/inhibit.c b/src/login/inhibit.c index a1602031b4..d82aba8ec3 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } if (arg_legend) { diff --git a/src/login/loginctl.c b/src/login/loginctl.c index ee617929ff..78dfab7071 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } if (arg_legend) { diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index f41cf464b1..ace6439c79 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } if (arg_legend) { diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 46bb0e5437..d4de823345 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } if (arg_legend) { diff --git a/src/shared/format-table.h b/src/shared/format-table.h index 20b4ebd39b..c828105f2c 100644 --- a/src/shared/format-table.h +++ b/src/shared/format-table.h @@ -130,3 +130,6 @@ 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") diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 954e5080ea..3933011c92 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); return 0; } diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 96be78746d..102ffece63 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); return 0; } @@ -526,7 +526,7 @@ static int print_ntp_status_info(NTPStatusInfo *i) { r = table_print(table, NULL); if (r < 0) - log_error_errno(r, "Failed to show table: %m"); + table_log_show_error(r); return 0; } diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index 382a1cc9e4..55984518d0 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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_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 log_error_errno(r, "Failed to show table: %m"); + return table_log_show_error(r); } return ret; |