fping: Initialize msghdr struct in a portable way

Initializing the structure assuming glibc layout results in
compile errors on musl, therefore do partial intialization and then
assigning the members individually.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
pull/281/head
Khem Raj 2 years ago committed by David Schweikert
parent f94adaf29e
commit c0fbccb977

@ -1962,15 +1962,13 @@ int receive_packet(int64_t wait_time,
reply_buf, reply_buf,
reply_buf_len reply_buf_len
}; };
struct msghdr recv_msghdr = { struct msghdr recv_msghdr = {0};
reply_src_addr, recv_msghdr.msg_name = reply_src_addr;
reply_src_addr_len, recv_msghdr.msg_namelen = reply_src_addr_len;
&msg_iov, recv_msghdr.msg_iov = &msg_iov;
1, recv_msghdr.msg_iovlen = 1;
&msg_control, recv_msghdr.msg_control = &msg_control;
sizeof(msg_control), recv_msghdr.msg_controllen = sizeof(msg_control);
0
};
#if HAVE_SO_TIMESTAMPNS #if HAVE_SO_TIMESTAMPNS
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
#endif #endif

Loading…
Cancel
Save