chiark / gitweb /
logind: fix generation of seat state file
[elogind.git] / src / logind-seat.c
index ed67bc9eea8d4fc89a354e97d02cd67e941c6545..5663aeea4bb46de06ce996d1cde24f060636ac97 100644 (file)
@@ -117,27 +117,20 @@ int seat_save(Seat *s) {
         if (s->sessions) {
                 Session *i;
 
-                fputs("OTHER=", f);
+                fputs("SESSIONS=", f);
                 LIST_FOREACH(sessions_by_seat, i, s->sessions) {
-                        if (i == s->active)
-                                continue;
-
                         fprintf(f,
                                 "%s%c",
                                 i->id,
                                 i->sessions_by_seat_next ? ' ' : '\n');
                 }
 
-                fputs("OTHER_UIDS=", f);
-                LIST_FOREACH(sessions_by_seat, i, s->sessions) {
-                        if (i == s->active)
-                                continue;
-
+                fputs("UIDS=", f);
+                LIST_FOREACH(sessions_by_seat, i, s->sessions)
                         fprintf(f,
                                 "%lu%c",
                                 (unsigned long) i->user->uid,
                                 i->sessions_by_seat_next ? ' ' : '\n');
-                }
         }
 
         fflush(f);
@@ -253,11 +246,15 @@ int seat_set_active(Seat *s, Session *session) {
 
         seat_save(s);
 
-        if (session)
+        if (session) {
                 session_save(session);
+                user_save(session->user);
+        }
 
-        if (old_active)
+        if (old_active) {
                 session_save(old_active);
+                user_save(old_active->user);
+        }
 
         return 0;
 }
@@ -340,11 +337,11 @@ int seat_start(Seat *s) {
         /* Read current VT */
         seat_read_active_vt(s);
 
+        s->started = true;
+
         /* Save seat data */
         seat_save(s);
 
-        s->started = true;
-
         seat_send_signal(s, true);
 
         return 0;