Skip to content

Commit c38ef3d

Browse files
committed
oob/tcp: fix short writev handling in send_msg()
Fixes #3414 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent f568475 commit c38ef3d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

orte/mca/oob/tcp/oob_tcp_sendrecv.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2017 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -179,15 +181,8 @@ static int send_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_send_t* msg)
179181
/* header was fully written, but only a part of the msg data was written */
180182
msg->hdr_sent = true;
181183
rc -= msg->sdbytes;
182-
if (NULL != msg->data) {
183-
/* technically, this should never happen as iov_count
184-
* would be 1 for a zero-byte message, and so we cannot
185-
* have a case where we write the header and part of the
186-
* msg. However, code checkers don't know that and are
187-
* fooled by our earlier check for NULL, and so
188-
* we silence their warnings by using this check */
189-
msg->sdptr = (char *)msg->data + rc;
190-
}
184+
assert(2 == iov_count);
185+
msg->sdptr = (char *)iov[1].iov_base + rc;
191186
msg->sdbytes = ntohl(msg->hdr.nbytes) - rc;
192187
}
193188
return ORTE_ERR_RESOURCE_BUSY;

0 commit comments

Comments
 (0)