tree-wide: also use CMSG_TYPED_DATA() on writing message header

This commit is contained in:
Yu Watanabe 2023-04-13 18:34:59 +09:00
parent 1ebb0953f0
commit b5d39bb3ca
3 changed files with 4 additions and 4 deletions

View 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;

View 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();

View 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)