From: fangxiuning Date: Tue, 7 Jul 2020 02:29:14 +0000 (+0800) Subject: table add table_log_sort_error() X-Git-Tag: v246-rc1~9^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df83eb546b55222ef5cd30eb8d7c915f5be85878;p=thirdparty%2Fsystemd.git table add table_log_sort_error() --- diff --git a/src/home/homectl.c b/src/home/homectl.c index b5ad9d53d08..888e77bc4e8 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 d82aba8ec3a..d5f37d8dd81 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 78dfab70716..dd47ec381a5 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 ace6439c79e..7c3eaad842a 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 d4de823345b..889e240ea75 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 c828105f2c6..d2fee3dbddc 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")