]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
iov: handle EOF in iov_send_recv
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tue, 23 Jul 2013 08:30:12 +0000 (17:30 +0900)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 13 Aug 2013 14:30:50 +0000 (09:30 -0500)
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>
util/iov.c

index cc6e837c8368f81938bf98179d6c6328b5ed170d..f7055868082dee04b771cc35d73010278ad0579d 100644 (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;