diff options
author | fangxiuning <fangxiuning123@126.com> | 2020-07-07 10:29:14 +0800 |
---|---|---|
committer | fangxiuning <fangxiuning123@126.com> | 2020-07-08 10:53:57 +0800 |
commit | df83eb546b55222ef5cd30eb8d7c915f5be85878 (patch) | |
tree | 312da43685c4be29f704af4ac985c7c7f85e1108 | |
parent | d836018a73bc0cc9c1525aea0706e56213589a70 (diff) | |
download | systemd-df83eb546b55222ef5cd30eb8d7c915f5be85878.tar.gz |
table add table_log_sort_error()
-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 |
6 files changed, 8 insertions, 5 deletions
diff --git a/src/home/homectl.c b/src/home/homectl.c index b5ad9d53d0..888e77bc4e 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -168,7 +168,7 @@ static int list_homes(int argc, char *argv[], void *userdata) { if (table_get_rows(table) > 1 || arg_json) { r = table_set_sort(table, (size_t) 0, (size_t) -1); if (r < 0) - return log_error_errno(r, "Failed to sort table: %m"); + return table_log_sort_error(r); table_set_header(table, arg_legend); diff --git a/src/login/inhibit.c b/src/login/inhibit.c index d82aba8ec3..d5f37d8dd8 100644 --- a/src/login/inhibit.c +++ b/src/login/inhibit.c @@ -132,7 +132,7 @@ static int print_inhibitors(sd_bus *bus) { if (table_get_rows(table) > 1) { r = table_set_sort(table, (size_t) 1, (size_t) 0, (size_t) 5, (size_t) 6, (size_t) -1); if (r < 0) - return log_error_errno(r, "Failed to sort table: %m"); + return table_log_sort_error(r); table_set_header(table, arg_legend); diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 78dfab7071..dd47ec381a 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -91,7 +91,7 @@ static int show_table(Table *table, const char *word) { if (table_get_rows(table) > 1 || OUTPUT_MODE_IS_JSON(arg_output)) { r = table_set_sort(table, (size_t) 0, (size_t) -1); if (r < 0) - return log_error_errno(r, "Failed to sort table: %m"); + return table_log_sort_error(r); table_set_header(table, arg_legend); diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index ace6439c79..7c3eaad842 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -237,7 +237,7 @@ static int show_table(Table *table, const char *word) { if (table_get_rows(table) > 1 || OUTPUT_MODE_IS_JSON(arg_output)) { r = table_set_sort(table, (size_t) 0, (size_t) -1); if (r < 0) - return log_error_errno(r, "Failed to sort table: %m"); + return table_log_sort_error(r); table_set_header(table, arg_legend); diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index d4de823345..889e240ea7 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -744,7 +744,7 @@ static int list_images(int argc, char *argv[], void *userdata) { if (table_get_rows(table) > 1) { r = table_set_sort(table, (size_t) 0, (size_t) -1); if (r < 0) - return log_error_errno(r, "Failed to sort table: %m"); + return table_log_sort_error(r); table_set_header(table, arg_legend); diff --git a/src/shared/format-table.h b/src/shared/format-table.h index c828105f2c..d2fee3dbdd 100644 --- a/src/shared/format-table.h +++ b/src/shared/format-table.h @@ -133,3 +133,6 @@ int table_print_json(Table *t, FILE *f, JsonFormatFlags json_flags); #define table_log_show_error(r) \ log_error_errno(r, "Failed to show table: %m") + +#define table_log_sort_error(r) \ + log_error_errno(r, "Failed to sort table: %m") |