]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: rearrange variables, use ASSERT_PTR
authorMike Yuan <me@yhndnzj.com>
Fri, 1 Mar 2024 13:43:12 +0000 (21:43 +0800)
committerMike Yuan <me@yhndnzj.com>
Fri, 1 Mar 2024 13:49:08 +0000 (21:49 +0800)
src/core/service.c

index 086404f67523f0ee68b0c2195ee4687e8838e8d2..77531bbba92021ab6e7e294a107f832bcdad691f 100644 (file)
@@ -4364,25 +4364,23 @@ static void service_notify_message(
                 char * const *tags,
                 FDSet *fds) {
 
-        Service *s = SERVICE(u);
-        bool notify_dbus = false;
-        usec_t monotonic_usec = USEC_INFINITY;
-        const char *e;
+        Service *s = ASSERT_PTR(SERVICE(u));
         int r;
 
-        assert(u);
         assert(ucred);
 
         if (!service_notify_message_authorized(s, ucred->pid, fds))
                 return;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *cc = NULL;
-
-                cc = strv_join(tags, ", ");
+                _cleanup_free_ char *cc = strv_join(tags, ", ");
                 log_unit_debug(u, "Got notification message from PID "PID_FMT" (%s)", ucred->pid, empty_to_na(cc));
         }
 
+        usec_t monotonic_usec = USEC_INFINITY;
+        bool notify_dbus = false;
+        const char *e;
+
         /* Interpret MAINPID= */
         e = strv_find_startswith(tags, "MAINPID=");
         if (e && IN_SET(s->state, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD, SERVICE_RELOAD_SIGNAL, SERVICE_RELOAD_NOTIFY)) {