]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: also use CMSG_TYPED_DATA() on writing message header 27253/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Apr 2023 09:34:59 +0000 (18:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Apr 2023 04:26:58 +0000 (13:26 +0900)
src/libsystemd-network/sd-dhcp-server.c
src/libsystemd/sd-daemon/sd-daemon.c
src/resolve/resolved-manager.c

index b9c77eafa5a2aa0e9978be6f2d4baa95caf0ff58..05c0cddfd09557983226c24a048354e60e08b07f 100644 (file)
@@ -407,7 +407,7 @@ static int dhcp_server_send_udp(sd_dhcp_server *server, be32_t destination,
                    rather than binding the socket. This will be mostly useful
                    when we gain support for arbitrary number of server addresses
                  */
-                pktinfo = (struct in_pktinfo*) CMSG_DATA(cmsg);
+                pktinfo = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
                 assert(pktinfo);
 
                 pktinfo->ipi_ifindex = server->ifindex;
index 8dc11aeb306afb1126070a10d44afca83ee29b53..f2f295d6e4e09f0181c1ca083d77c90efc796fb4 100644 (file)
@@ -567,7 +567,7 @@ _public_ int sd_pid_notify_with_fds(
                         cmsg->cmsg_type = SCM_CREDENTIALS;
                         cmsg->cmsg_len = CMSG_LEN(sizeof(struct ucred));
 
-                        ucred = (struct ucred*) CMSG_DATA(cmsg);
+                        ucred = CMSG_TYPED_DATA(cmsg, struct ucred);
                         ucred->pid = pid != 0 ? pid : getpid_cached();
                         ucred->uid = getuid();
                         ucred->gid = getgid();
index e5e1411a13d0adeb2fa7b70ddfd5a6f07675a318..184d8e3f3d33982123a4c415edd65c0daf8d7c29 100644 (file)
@@ -1017,7 +1017,7 @@ static int manager_ipv4_send(
                 cmsg->cmsg_level = IPPROTO_IP;
                 cmsg->cmsg_type = IP_PKTINFO;
 
-                pi = (struct in_pktinfo*) CMSG_DATA(cmsg);
+                pi = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
                 pi->ipi_ifindex = ifindex;
 
                 if (source)
@@ -1073,7 +1073,7 @@ static int manager_ipv6_send(
                 cmsg->cmsg_level = IPPROTO_IPV6;
                 cmsg->cmsg_type = IPV6_PKTINFO;
 
-                pi = (struct in6_pktinfo*) CMSG_DATA(cmsg);
+                pi = CMSG_TYPED_DATA(cmsg, struct in6_pktinfo);
                 pi->ipi6_ifindex = ifindex;
 
                 if (source)