Skip to content

Commit cef772b

Browse files
committed
Use aggregate initialization to ensure all fields are set
Removes complaints from coverity about msg.msg_flags not being set. For more information about this read the discussion on #11915. Signed-off-by: George Bosilca <[email protected]>
1 parent 2ebdfbb commit cef772b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

opal/mca/btl/tcp/btl_tcp_frag.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,11 @@ bool mca_btl_tcp_frag_send(mca_btl_tcp_frag_t *frag, int sd)
105105
{
106106
ssize_t cnt;
107107
size_t i, num_vecs;
108-
struct msghdr msg;
108+
struct msghdr msg = {
109+
.msg_iov = frag->iov_ptr,
110+
.msg_iovlen = frag->iov_cnt };
109111
int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
110112

111-
msg.msg_name = NULL;
112-
msg.msg_namelen = 0;
113-
msg.msg_iov = frag->iov_ptr;
114-
msg.msg_iovlen = frag->iov_cnt;
115-
msg.msg_control = NULL;
116-
msg.msg_controllen = 0;
117-
118113
/* non-blocking write, continue if interrupted */
119114
do {
120115
/* Use sendmsg to avoid issues with SIGPIPE as described in

0 commit comments

Comments
 (0)