From: Lennart Poettering Date: Fri, 10 Jan 2025 08:39:05 +0000 (+0100) Subject: logind: introduce macro for the last session class condition check X-Git-Tag: v258-rc1~1591^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6ad410ffa5d63647ea9048932b7b459cbe55662;p=thirdparty%2Fsystemd.git logind: introduce macro for the last session class condition check For all checks regarding the properties of sessoin classes we have SESSION_CLASS_CAN_XYZ() style macros. Except for one. Convert that one too. --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 28bc7b6cefb..ab39cc0644b 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1835,7 +1835,7 @@ static int have_multiple_sessions( /* Check for other users' sessions. Greeter sessions do not * count, and non-login sessions do not count either. */ HASHMAP_FOREACH(session, m->sessions) - if (IN_SET(session->class, SESSION_USER, SESSION_USER_EARLY) && + if (SESSION_CLASS_IS_INHIBITOR_LIKE(session->class) && session->user->user_record->uid != uid) return true; diff --git a/src/login/logind-session.h b/src/login/logind-session.h index 8ecd90b7ae1..53ac92e5d20 100644 --- a/src/login/logind-session.h +++ b/src/login/logind-session.h @@ -65,6 +65,9 @@ typedef enum SessionClass { /* Which session classes allow changing session types */ #define SESSION_CLASS_CAN_CHANGE_TYPE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER, SESSION_LOCK_SCREEN)) +/* Which session classes are taken into acccount when deciding whether shutdown shall be allowed if other users are logged in */ +#define SESSION_CLASS_IS_INHIBITOR_LIKE(class) IN_SET((class), SESSION_USER, SESSION_USER_EARLY) + typedef enum SessionType { SESSION_UNSPECIFIED, SESSION_TTY,