summaryrefslogtreecommitdiffstats
path: root/src/login/inhibit.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
commitfc53809803cd2bc2434e312b19a18fa36776da12 (patch)
treeb4b43bd6538f51965ce32856e9c053d0f90919c8 /src/login/inhibit.c
parentAdding upstream version 255.5. (diff)
downloadsystemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz
systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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)