From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RinNY-0003Ep-Tj for qemu-devel@nongnu.org; Thu, 05 Jan 2012 08:29:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RinNX-0000PO-TL for qemu-devel@nongnu.org; Thu, 05 Jan 2012 08:29:12 -0500 Message-ID: <4F05A59D.4060407@redhat.com> Date: Thu, 05 Jan 2012 14:29:01 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1325769367-32267-1-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1325769367-32267-1-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Dr David Alan Gilbert On 01/05/2012 02:16 PM, Stefan Hajnoczi wrote: > For some reason nbd_client_thread() has a do..while loop which can never > loop, the condition is bogus because we would take a goto instead. Drop > the loop. > > Reported-by: Dr David Alan Gilbert > Signed-off-by: Stefan Hajnoczi > --- > qemu-nbd.c | 10 ++++------ > 1 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/qemu-nbd.c b/qemu-nbd.c > index 155b058..eb61c33 100644 > --- a/qemu-nbd.c > +++ b/qemu-nbd.c > @@ -202,12 +202,10 @@ static void *nbd_client_thread(void *arg) > int ret; > pthread_t show_parts_thread; > > - do { > - sock = unix_socket_outgoing(sockpath); > - if (sock == -1) { > - goto out; > - } > - } while (sock == -1); > + sock = unix_socket_outgoing(sockpath); > + if (sock == -1) { > + goto out; > + } > > ret = nbd_receive_negotiate(sock, NULL,&nbdflags, > &size,&blocksize); Reviewed-by: Paolo Bonzini It used to loop until commit f1ef555. When I simplified the loop I failed to actually remove it. I suppose it will get in through your trivial patches tree, won't it? Paolo