logind-user: take gc_mode into account when reporting user state
authorMike Yuan <me@yhndnzj.com>
Sat, 6 Jul 2024 17:05:57 +0000 (19:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 12 Jul 2024 16:32:53 +0000 (18:32 +0200)
commit56f4ab290643547853276fb72b4e6960586c3e7c
treed809c928ffb2b51554257e000cca5459d198229c
parent8f036c928e54db467fbe16bfc7161b789b9fde96
logind-user: take gc_mode into account when reporting user state

Prompted by #33650

Previously, if a user manually starts user@.service (which is
something we support), we'd track it as 'manager' session.
However, since user_get_state() ignores all non-pinning sessions,
if lingering is not enabled, the user state would always be
reported as 'closing', which is spurious.

Let's instead take gc_mode into consideration, and ignore
non-pinning sessions only if USER_GC_BY_PIN.
src/login/logind-user.c