@@ -112,7 +112,7 @@ size_t mca_btl_tcp_frag_dump(mca_btl_tcp_frag_t* frag, char* msg, char* buf, siz
112112
113113bool mca_btl_tcp_frag_send (mca_btl_tcp_frag_t * frag , int sd )
114114{
115- int cnt = -1 ;
115+ ssize_t cnt = -1 ;
116116 size_t i , num_vecs ;
117117
118118 /* non-blocking write, but continue if interrupted */
@@ -145,7 +145,7 @@ bool mca_btl_tcp_frag_send(mca_btl_tcp_frag_t* frag, int sd)
145145 /* if the write didn't complete - update the iovec state */
146146 num_vecs = frag -> iov_cnt ;
147147 for (i = 0 ; i < num_vecs ; i ++ ) {
148- if (cnt >= (int )frag -> iov_ptr -> iov_len ) {
148+ if (cnt >= (ssize_t )frag -> iov_ptr -> iov_len ) {
149149 cnt -= frag -> iov_ptr -> iov_len ;
150150 frag -> iov_ptr ++ ;
151151 frag -> iov_idx ++ ;
@@ -155,7 +155,7 @@ bool mca_btl_tcp_frag_send(mca_btl_tcp_frag_t* frag, int sd)
155155 (((unsigned char * )frag -> iov_ptr -> iov_base ) + cnt );
156156 frag -> iov_ptr -> iov_len -= cnt ;
157157 OPAL_OUTPUT_VERBOSE ((100 , opal_btl_base_framework .framework_output ,
158- "%s:%d write %d bytes on socket %d\n" ,
158+ "%s:%d write %ld bytes on socket %d\n" ,
159159 __FILE__ , __LINE__ , cnt , sd ));
160160 break ;
161161 }
@@ -211,18 +211,18 @@ bool mca_btl_tcp_frag_recv(mca_btl_tcp_frag_t* frag, int sd)
211211 cnt = -1 ;
212212 while ( cnt < 0 ) {
213213 cnt = readv (sd , frag -> iov_ptr , num_vecs );
214- if ( 0 < cnt ) goto advance_iov_position ;
215- if ( cnt == 0 ) {
216- btl_endpoint -> endpoint_state = MCA_BTL_TCP_FAILED ;
217- mca_btl_tcp_endpoint_close (btl_endpoint );
218- return false;
219- }
220- switch (opal_socket_errno ) {
221- case EINTR :
222- continue ;
223- case EWOULDBLOCK :
224- return false;
225- case EFAULT :
214+ if ( 0 < cnt ) goto advance_iov_position ;
215+ if ( cnt == 0 ) {
216+ btl_endpoint -> endpoint_state = MCA_BTL_TCP_FAILED ;
217+ mca_btl_tcp_endpoint_close (btl_endpoint );
218+ return false;
219+ }
220+ switch (opal_socket_errno ) {
221+ case EINTR :
222+ continue ;
223+ case EWOULDBLOCK :
224+ return false;
225+ case EFAULT :
226226 BTL_ERROR (("mca_btl_tcp_frag_recv: readv error (%p, %lu)\n\t%s(%lu)\n" ,
227227 frag -> iov_ptr [0 ].iov_base , (unsigned long ) frag -> iov_ptr [0 ].iov_len ,
228228 strerror (opal_socket_errno ), (unsigned long ) frag -> iov_cnt ));
@@ -253,17 +253,17 @@ bool mca_btl_tcp_frag_recv(mca_btl_tcp_frag_t* frag, int sd)
253253 /* if the read didn't complete - update the iovec state */
254254 num_vecs = frag -> iov_cnt ;
255255 for ( i = 0 ; i < num_vecs ; i ++ ) {
256- if ( cnt < (int )frag -> iov_ptr -> iov_len ) {
256+ if ( cnt < (ssize_t )frag -> iov_ptr -> iov_len ) {
257257 frag -> iov_ptr -> iov_base = (opal_iov_base_ptr_t )
258258 (((unsigned char * )frag -> iov_ptr -> iov_base ) + cnt );
259259 frag -> iov_ptr -> iov_len -= cnt ;
260260 cnt = 0 ;
261261 break ;
262- }
263- cnt -= frag -> iov_ptr -> iov_len ;
264- frag -> iov_idx ++ ;
265- frag -> iov_ptr ++ ;
266- frag -> iov_cnt -- ;
262+ }
263+ cnt -= frag -> iov_ptr -> iov_len ;
264+ frag -> iov_idx ++ ;
265+ frag -> iov_ptr ++ ;
266+ frag -> iov_cnt -- ;
267267 }
268268#if MCA_BTL_TCP_ENDPOINT_CACHE
269269 btl_endpoint -> endpoint_cache_length = cnt ;
0 commit comments