1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

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.
This commit is contained in:
Lennart Poettering 2025-01-10 09:39:05 +01:00
parent 29f2057a20
commit a6ad410ffa
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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,