]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: introduce macro for the last session class condition check
authorLennart Poettering <lennart@poettering.net>
Fri, 10 Jan 2025 08:39:05 +0000 (09:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 15 Jan 2025 16:03:21 +0000 (17:03 +0100)
For all checks regarding the properties of sessoin classes we have
SESSION_CLASS_CAN_XYZ() style macros. Except for one. Convert that one
too.

src/login/logind-dbus.c
src/login/logind-session.h

index 28bc7b6cefbf65ceb82abac78f91192bba4d67a3..ab39cc0644be12d07044bf4a1481277412b810aa 100644 (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;
 
index 8ecd90b7ae17c2ba49e261cc1fdb20660ecf4fa6..53ac92e5d2045edc60eff76583563abb10486afe 100644 (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,