1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

logind-dbus: set gc_mode to USER_GC_BY_PIN when disable linger

The mode switch from any to pin is currently done in create_session().
However, if no (pinning) session is created before (or after) linger
is disabled, the user will not be gc'd after that. Therefore, also
perform the mode switch when linger is being disabled.

(cherry picked from commit 1df981a74ae19513b40167c6b320c30bd166ac34)
This commit is contained in:
Tom Yan 2024-07-08 22:10:43 +08:00 committed by Luca Boccassi
parent 5d6bf58cf2
commit 7122e226c3

View File

@ -1484,8 +1484,11 @@ static int method_set_user_linger(sd_bus_message *message, void *userdata, sd_bu
return -errno;
u = hashmap_get(m->users, UID_TO_PTR(uid));
if (u)
if (u) {
/* Make sure that disabling lingering will terminate the user tracking if no sessions pin it. */
u->gc_mode = USER_GC_BY_PIN;
user_add_to_gc_queue(u);
}
}
return sd_bus_reply_method_return(message, NULL);