[systemd-devel] [PATCH] loginctl: corretly show session IDs on session-status

Djalal Harouni tixxdz at opendz.org
Sat Dec 21 06:49:46 PST 2013


Commit f8f14b3654bcd introduced a regression that makes
loginctl session-status to not show the correct session ID(s)

In print_session_status_info() the map[] array, element "Seat" receives
the offset of the "id" in "SessionStatusInfo" struct instead of the
offset of the "seat" member.

This will cause prop_map_first_of_struct() function to overwrite the
SessionStatusInfo.id memory with seats if there are any.

Fix this typo by using the "seat" member.

Before:
 - tixxdz (1000)
          Since: Sat 2013-12-21 10:07:23 CET; 5h 26min ago
         Leader: 1265 (sshd)

After:
1 - tixxdz (1000)
           Since: Sat 2013-12-21 10:07:23 CET; 5h 26min ago
          Leader: 1265 (sshd)
---
 src/login/loginctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 5f3221e..725f169 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -365,7 +365,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
                 { "Remote",     "b", NULL, offsetof(SessionStatusInfo, remote) },
                 { "Timestamp",  "t", NULL, offsetof(SessionStatusInfo, timestamp) },
                 { "User",       "(uo)", prop_map_first_of_struct, offsetof(SessionStatusInfo, uid) },
-                { "Seat",       "(so)", prop_map_first_of_struct, offsetof(SessionStatusInfo, id) },
+                { "Seat",       "(so)", prop_map_first_of_struct, offsetof(SessionStatusInfo, seat) },
                 {}
         };
 
@@ -412,7 +412,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
                 printf("\n");
         }
 
-        if (i.seat) {
+        if (!isempty(i.seat)) {
                 printf("\t    Seat: %s", i.seat);
 
                 if (i.vtnr > 0)
-- 
1.8.3.1



More information about the systemd-devel mailing list