]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: normalize parameter to create_session()
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2024 14:55:03 +0000 (15:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 8 Jan 2025 10:20:18 +0000 (11:20 +0100)
We can pass a properly typed Manager object here, no reason to pass it
as void*.

src/login/logind-dbus.c

index 4b14b9b690a46142f1c6e292db7113397e2266e1..d5038812d8f679cc872a42a6daf6406bdf7e9647 100644 (file)
@@ -85,6 +85,8 @@ static int get_sender_session(
         const char *name;
         int r;
 
+        assert(m);
+
         /* Acquire the sender's session. This first checks if the sending process is inside a session itself,
          * and returns that. If not and 'consult_display' is true, this returns the display session of the
          * owning user of the caller. */
@@ -828,8 +830,8 @@ static int method_list_inhibitors(sd_bus_message *message, void *userdata, sd_bu
 }
 
 static int create_session(
+                Manager *m,
                 sd_bus_message *message,
-                void *userdata,
                 sd_bus_error *error,
                 uid_t uid,
                 pid_t leader_pid,
@@ -848,7 +850,6 @@ static int create_session(
                 uint64_t flags) {
 
         _cleanup_(pidref_done) PidRef leader = PIDREF_NULL;
-        Manager *m = ASSERT_PTR(userdata);
         _cleanup_free_ char *id = NULL;
         Session *session = NULL;
         uint32_t audit_id = 0;
@@ -858,6 +859,7 @@ static int create_session(
         SessionClass c;
         int r;
 
+        assert(m);
         assert(message);
 
         if (!uid_is_valid(uid))
@@ -1176,8 +1178,8 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
                 return r;
 
         return create_session(
-                        message,
                         userdata,
+                        message,
                         error,
                         uid,
                         leader_pid,
@@ -1224,8 +1226,8 @@ static int method_create_session_pidfd(sd_bus_message *message, void *userdata,
                 return r;
 
         return create_session(
-                        message,
                         userdata,
+                        message,
                         error,
                         uid,
                         /* leader_pid = */ 0,