From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1ali-0003iE-Rd for qemu-devel@nongnu.org; Tue, 23 Jul 2013 07:28:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1alg-0006ow-UG for qemu-devel@nongnu.org; Tue, 23 Jul 2013 07:28:38 -0400 Sender: Paolo Bonzini Message-ID: <51EE68D1.9090102@redhat.com> Date: Tue, 23 Jul 2013 13:28:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1374568221-23147-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> <1374568221-23147-3-git-send-email-morita.kazutaka@lab.ntt.co.jp> In-Reply-To: <1374568221-23147-3-git-send-email-morita.kazutaka@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/11] iov: handle EOF in iov_send_recv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: MORITA Kazutaka Cc: Kevin Wolf , sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org Il 23/07/2013 10:30, MORITA Kazutaka ha scritto: > Without this patch, iov_send_recv() never returns when do_send_recv() > returns zero. > > Signed-off-by: MORITA Kazutaka > --- > 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; > Reviewed-by: Paolo Bonzini ... and should also be in 1.5.2. Paolo