diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-04-09 10:08:07 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-04-09 10:08:16 +0200 |
commit | 583a27d525ae189bdfaa6784021b92a9a1dae12e (patch) | |
tree | f5d2fa812102a1c6309eacbbc0ce1c71b2536c7c /resolv | |
parent | 942de61a89c5a01847d96831cb5e56630a7ba450 (diff) | |
download | glibc-583a27d525ae189bdfaa6784021b92a9a1dae12e.tar glibc-583a27d525ae189bdfaa6784021b92a9a1dae12e.tar.gz glibc-583a27d525ae189bdfaa6784021b92a9a1dae12e.tar.bz2 glibc-583a27d525ae189bdfaa6784021b92a9a1dae12e.zip |
resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/res_send.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c index 7debf143f7..9e9541789b 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -1157,25 +1157,27 @@ send_dg(res_state statp, if (have_sendmmsg >= 0 && nwritten == 0 && buf2 != NULL && !single_request) { - struct iovec iov[2]; - struct mmsghdr reqs[2]; - reqs[0].msg_hdr.msg_name = NULL; - reqs[0].msg_hdr.msg_namelen = 0; - reqs[0].msg_hdr.msg_iov = &iov[0]; - reqs[0].msg_hdr.msg_iovlen = 1; - iov[0].iov_base = (void *) buf; - iov[0].iov_len = buflen; - reqs[0].msg_hdr.msg_control = NULL; - reqs[0].msg_hdr.msg_controllen = 0; - - reqs[1].msg_hdr.msg_name = NULL; - reqs[1].msg_hdr.msg_namelen = 0; - reqs[1].msg_hdr.msg_iov = &iov[1]; - reqs[1].msg_hdr.msg_iovlen = 1; - iov[1].iov_base = (void *) buf2; - iov[1].iov_len = buflen2; - reqs[1].msg_hdr.msg_control = NULL; - reqs[1].msg_hdr.msg_controllen = 0; + struct iovec iov = + { .iov_base = (void *) buf, .iov_len = buflen }; + struct iovec iov2 = + { .iov_base = (void *) buf2, .iov_len = buflen2 }; + struct mmsghdr reqs[2] = + { + { + .msg_hdr = + { + .msg_iov = &iov, + .msg_iovlen = 1, + }, + }, + { + .msg_hdr = + { + .msg_iov = &iov2, + .msg_iovlen = 1, + } + }, + }; int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL); if (__glibc_likely (ndg == 2)) |