]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: remove redundant Unit.type check
authorMike Yuan <me@yhndnzj.com>
Tue, 26 Mar 2024 10:55:19 +0000 (18:55 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 26 Mar 2024 10:55:19 +0000 (18:55 +0800)
SOCKET(u) returns NULL if the type doesn't match.

src/core/service.c

index 953cb2934aacaf5fc5429bbe30e1e6fef46c91d8..ba71f974744dde7d054540d3bdcc6e38c133c01e 100644 (file)
@@ -1409,10 +1409,9 @@ static int service_collect_fds(
                         Socket *sock;
                         int cn_fds;
 
-                        if (u->type != UNIT_SOCKET)
-                                continue;
-
                         sock = SOCKET(u);
+                        if (!sock)
+                                continue;
 
                         cn_fds = socket_collect_fds(sock, &cfds);
                         if (cn_fds < 0)