Skip to content

Commit 3a13bd6

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

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
@@ -182,15 +184,8 @@ static int send_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_send_t* msg)
182184
/* header was fully written, but only a part of the msg data was written */
183185
msg->hdr_sent = true;
184186
rc -= msg->sdbytes;
185-
if (NULL != msg->data) {
186-
/* technically, this should never happen as iov_count
187-
* would be 1 for a zero-byte message, and so we cannot
188-
* have a case where we write the header and part of the
189-
* msg. However, code checkers don't know that and are
190-
* fooled by our earlier check for NULL, and so
191-
* we silence their warnings by using this check */
192-
msg->sdptr = (char *)msg->data + rc;
193-
}
187+
assert(2 == iov_count);
188+
msg->sdptr = (char *)iov[1].iov_base + rc;
194189
msg->sdbytes = ntohl(msg->hdr.nbytes) - rc;
195190
}
196191
return ORTE_ERR_RESOURCE_BUSY;

0 commit comments

Comments
 (0)