Skip to content

Commit

Permalink
logind: tighten for which classes of sessions we do stop-on-idle
Browse files Browse the repository at this point in the history
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: 508b478

(cherry picked from commit ad23439)

Related: RHEL-24340
  • Loading branch information
poettering authored and github-actions[bot] committed Nov 27, 2024
1 parent ebb65ff commit 8554520
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/login/logind-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,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(
Expand Down
3 changes: 3 additions & 0 deletions src/login/logind-session.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ typedef enum SessionClass {
_SESSION_CLASS_INVALID = -EINVAL,
} SessionClass;

/* Which sessions classes should be subject to stop-in-idle */
#define SESSION_CLASS_CAN_STOP_ON_IDLE(class) (IN_SET((class), SESSION_USER))

typedef enum SessionType {
SESSION_UNSPECIFIED,
SESSION_TTY,
Expand Down

0 comments on commit 8554520

Please sign in to comment.