summaryrefslogtreecommitdiffstats
path: root/src/login/inhibit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/login/inhibit.c')
-rw-r--r--src/login/inhibit.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index ad73c4b..4682830 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -111,7 +111,7 @@ static int print_inhibitors(sd_bus *bus) {
if (r < 0)
return bus_log_parse_error(r);
- if (table_get_rows(table) > 1) {
+ if (!table_isempty(table)) {
r = table_set_sort(table, (size_t) 1, (size_t) 0, (size_t) 5, (size_t) 6);
if (r < 0)
return table_log_sort_error(r);
@@ -124,10 +124,10 @@ static int print_inhibitors(sd_bus *bus) {
}
if (arg_legend) {
- if (table_get_rows(table) > 1)
- printf("\n%zu inhibitors listed.\n", table_get_rows(table) - 1);
- else
+ if (table_isempty(table))
printf("No inhibitors.\n");
+ else
+ printf("\n%zu inhibitors listed.\n", table_get_rows(table) - 1);
}
return 0;
@@ -257,9 +257,7 @@ static int run(int argc, char *argv[]) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
- log_show_color(true);
- log_parse_environment();
- log_open();
+ log_setup();
r = parse_argv(argc, argv);
if (r <= 0)