machinectl/loginctl: show json output if requested even if zero entries
This commit is contained in:
@@ -94,7 +94,7 @@ static int show_table(Table *table, const char *word) {
|
||||
assert(table);
|
||||
assert(word);
|
||||
|
||||
if (table_get_rows(table) > 1) {
|
||||
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");
|
||||
|
||||
@@ -255,7 +255,7 @@ static int show_table(Table *table, const char *word) {
|
||||
assert(table);
|
||||
assert(word);
|
||||
|
||||
if (table_get_rows(table) > 1) {
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user