From: Lennart Poettering Date: Thu, 4 Jan 2024 12:40:00 +0000 (+0100) Subject: logind: tighten for which classes of sessions we do stop-on-idle X-Git-Tag: v256-rc1~1186^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad23439eae718ac3634f260be0d29e01445983a8;p=thirdparty%2Fsystemd.git logind: tighten for which classes of sessions we do stop-on-idle We only want to do this for fully set up, interactive sessions, i.e. user and user-early, but not for any others, hence restrict the rules a bit. Follow-up for: 508b4786e8592e82eb4832549f74aaa54335d14c --- diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 3226f3db783..69dc52ad66c 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -817,7 +817,7 @@ static int session_setup_stop_on_idle_timer(Session *s) { assert(s); - if (s->manager->stop_idle_session_usec == USEC_INFINITY || IN_SET(s->class, SESSION_GREETER, SESSION_LOCK_SCREEN)) + if (s->manager->stop_idle_session_usec == USEC_INFINITY || !SESSION_CLASS_CAN_STOP_ON_IDLE(s->class)) return 0; r = sd_event_add_time_relative( diff --git a/src/login/logind-session.h b/src/login/logind-session.h index 9cba60c18f6..a7d90e997e5 100644 --- a/src/login/logind-session.h +++ b/src/login/logind-session.h @@ -54,6 +54,9 @@ typedef enum SessionClass { /* Which sessions are candidates to become "display" sessions */ #define SESSION_CLASS_CAN_DISPLAY(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER)) +/* Which sessions classes should be subject to stop-in-idle */ +#define SESSION_CLASS_CAN_STOP_ON_IDLE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY)) + typedef enum SessionType { SESSION_UNSPECIFIED, SESSION_TTY,