qemu-nbd: drop loop which can never loop
PATCH 1/1 qemu-nbd: drop loop which can never loop
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.
--- qemu-nbd.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
qemu-nbd.c +4 -6
@@ -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);
Signature · 1 line
1.7.7.3
Quoted 21 lines · Stefan Hajnoczi
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<[email protected]>Signed-off-by Stefan Hajnoczi<[email protected]>--- qemu-nbd.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)qemu-nbd.c +0
-3@@ -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) {
qemu-nbd.c static void *nbd_client_thread(void *arg) · line 211
Quoted 10 lines
qemu-nbd.c +4
-3- goto out; - } - }while (sock ==-1 ); + sock =unix_socket_outgoing (sockpath); +if (sock ==-1 ) { + goto out; + } ret =nbd_receive_negotiate (sock,NULL ,&nbdflags, &size,&blocksize);
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
Quoted 1 line · Paolo Bonzini
I suppose it will get in through your trivial patches tree, won't it?
Yes
Stefan Hajnoczi
AppliedQuoted 9 lines · Stefan Hajnoczi
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 <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- qemu-nbd.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
Applied to the trivial patches -next tree:
https://github.com/stefanha/qemu/commits/trivial-patches-next
Stefan