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: 508b4786e8592e82eb4832549f74aaa54335d14c

(cherry picked from commit ad23439eae718ac3634f260be0d29e01445983a8)

Related: RHEL-19215
  • Loading branch information
poettering authored and jamacku committed Nov 6, 2024
1 parent c87954f commit 77a215e
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 @@ -713,7 +713,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 @@ -26,6 +26,9 @@ typedef enum SessionClass {
_SESSION_CLASS_INVALID = -1
} 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 77a215e

Please sign in to comment.