]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
table add table_log_sort_error()
authorfangxiuning <fangxiuning123@126.com>
Tue, 7 Jul 2020 02:29:14 +0000 (10:29 +0800)
committerfangxiuning <fangxiuning123@126.com>
Wed, 8 Jul 2020 02:53:57 +0000 (10:53 +0800)
src/home/homectl.c
src/login/inhibit.c
src/login/loginctl.c
src/machine/machinectl.c
src/portable/portablectl.c
src/shared/format-table.h

index b5ad9d53d083fe3f22c591220db3dd910a7fe3ac..888e77bc4e89ad6a9ba57d1d99913909c69cc603 100644 (file)
@@ -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);
 
index d82aba8ec3a3cebe417b72ffccd8b4cdb8262875..d5f37d8dd8153bddbf2496341e036ac717b597db 100644 (file)
@@ -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);
 
index 78dfab70716269fd0336a7a50f2f19e552aa593a..dd47ec381a5e39c16ed7ebf8007ec536b6852e07 100644 (file)
@@ -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);
 
index ace6439c79e40f6699a22c818fc71a7c53ea93c8..7c3eaad842a949ca34d1eb32fc2b0a56f93c3250 100644 (file)
@@ -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);
 
index d4de823345ba348a89a31d0fb1b045c3b1736452..889e240ea756839f6b62f823c7483a60261aa5bc 100644 (file)
@@ -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);
 
index c828105f2c6073ab02c3dd2fc371ebfc09915f33..d2fee3dbddcf10ae4d7c1ab13340350ef3c18a59 100644 (file)
@@ -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")