diff options
author | MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> | 2013-07-23 17:30:12 +0900 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2013-08-13 09:30:50 -0500 |
commit | ca73e42f6d9581f785ff12a441501d94a97f5532 (patch) | |
tree | 3ee58802619b4ea5d77157e6616f4a328e9cdb04 | |
parent | 7f91e37c5a940b2ba14df04b1f1363bceddc658d (diff) |
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>
(cherry picked from commit 840042901710c2dc1a3ac3e5af9bed449c339701)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | util/iov.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/util/iov.c b/util/iov.c index cc6e837c83..f705586808 100644 --- a/util/iov.c +++ b/util/iov.c @@ -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; |