From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6iQe-0002l5-GH for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:40:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6iQZ-0002Ug-6g for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:40:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6iQY-0002UY-Vh for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:39:59 -0400 From: Kevin Wolf Date: Tue, 6 Aug 2013 16:39:39 +0200 Message-Id: <1375799990-995-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1375799990-995-1-git-send-email-kwolf@redhat.com> References: <1375799990-995-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 03/14] iov: handle EOF in iov_send_recv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: MORITA Kazutaka Without this patch, iov_send_recv() never returns when do_send_recv() returns zero. Signed-off-by: MORITA Kazutaka Reviewed-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- util/iov.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/iov.c b/util/iov.c index cc6e837..f705586 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; -- 1.8.1.4