iov: handle EOF in iov_send_recv

Without this patch, iov_send_recv() never returns when do_send_recv()
returns zero.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
master
MORITA Kazutaka 2013-07-23 17:30:12 +09:00 committed by Kevin Wolf
parent 526eda14a6
commit 8400429017
1 changed files with 6 additions and 0 deletions

View File

@ -202,6 +202,12 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
return -1;
}
if (ret == 0 && !do_send) {
/* recv returns 0 when the peer has performed an orderly
* shutdown. */
break;
}
/* Prepare for the next iteration */
offset += ret;
total += ret;