]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loginctl: set appropriate ersatz strings for all tables
authorLennart Poettering <lennart@poettering.net>
Mon, 27 Nov 2023 14:09:53 +0000 (15:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Nov 2023 10:33:01 +0000 (11:33 +0100)
src/login/loginctl.c
test/units/testsuite-35.sh

index fdf899c37f1570dd71f11971b556f98d44f2251e..e52555989f0f34b4a73cd0f7d7f357006e706267 100644 (file)
@@ -180,6 +180,8 @@ static int list_sessions(int argc, char *argv[], void *userdata) {
         (void) table_set_align_percent(table, TABLE_HEADER_CELL(0), 100);
         (void) table_set_align_percent(table, TABLE_HEADER_CELL(1), 100);
 
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_DASH);
+
         for (;;) {
                 _cleanup_(sd_bus_error_free) sd_bus_error e = SD_BUS_ERROR_NULL;
                 const char *id, *user, *seat, *object;
@@ -259,6 +261,7 @@ static int list_users(int argc, char *argv[], void *userdata) {
                 return log_oom();
 
         (void) table_set_align_percent(table, TABLE_HEADER_CELL(0), 100);
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_DASH);
 
         for (;;) {
                 _cleanup_(sd_bus_error_free) sd_bus_error error_property = SD_BUS_ERROR_NULL;
@@ -328,6 +331,8 @@ static int list_seats(int argc, char *argv[], void *userdata) {
         if (!table)
                 return log_oom();
 
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_DASH);
+
         for (;;) {
                 const char *seat;
 
@@ -504,6 +509,8 @@ static int print_session_status_info(sd_bus *bus, const char *path) {
         if (!table)
                 return log_oom();
 
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_NA);
+
         if (dual_timestamp_is_set(&i.timestamp)) {
                 r = table_add_cell(table, NULL, TABLE_FIELD, "Since");
                 if (r < 0)
@@ -692,6 +699,8 @@ static int print_user_status_info(sd_bus *bus, const char *path) {
         if (!table)
                 return log_oom();
 
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_NA);
+
         if (dual_timestamp_is_set(&i.timestamp)) {
                 r = table_add_cell(table, NULL, TABLE_FIELD, "Since");
                 if (r < 0)
@@ -790,6 +799,8 @@ static int print_seat_status_info(sd_bus *bus, const char *path) {
         if (!table)
                 return log_oom();
 
+        (void) table_set_ersatz_string(table, TABLE_ERSATZ_NA);
+
         if (!strv_isempty(i.sessions)) {
                 _cleanup_strv_free_ char **sessions = TAKE_PTR(i.sessions);
 
index fa942091e6f1fdae651b5989bc5844f2a64b8af9..36e26da885a28fabfd0cf9a773484110fdaf4a35 100755 (executable)
@@ -544,7 +544,7 @@ testcase_list_users_sessions_seats() {
     assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $5 }')" tty2
     assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $6 }')" active
     assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $7 }')" no
-    assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $8 }')" ''
+    assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $8 }')" '-'
 
     loginctl list-seats --no-legend | grep -Fwq "${seat?}"