mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-06-16 02:35:58 +00:00
logind: avoid creating stale session state files
There were old session state files accumulating in /run/systemd/session.
They confused e.g. "reboot", which thought there were still users logged
in. The files got created like this:
session_stop(Session *s) ->
...
unlink(s->state_file);
...
seat_set_active(s->seat, NULL) ->
session_save(...); /* re-creates the state file we just
unlinked */
Fix it simply by clearing the s->started flag earlier to prevent
any further writes of the state file (session_save() checks the flag).
(cherry picked from commit 50fb97935d)
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
cb8bbba80a
commit
74a2502ee5
@@ -710,6 +710,8 @@ int session_stop(Session *s) {
|
||||
if (s->started)
|
||||
session_send_signal(s, false);
|
||||
|
||||
s->started = false;
|
||||
|
||||
if (s->seat) {
|
||||
if (s->seat->active == s)
|
||||
seat_set_active(s->seat, NULL);
|
||||
@@ -721,8 +723,6 @@ int session_stop(Session *s) {
|
||||
user_send_changed(s->user, "Sessions\0");
|
||||
user_save(s->user);
|
||||
|
||||
s->started = false;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user