aboutsummaryrefslogtreecommitdiff
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-05-13 00:35:15 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2014-05-24 00:07:29 +0400
commit36af599417dde11747a27dc8550ff2281657a8ff (patch)
tree7bfe8799f5474489db6f25b2f6e77d3a72c0824c /qemu-nbd.c
parentaef553fdcabbea8760cd4647ab14859095300023 (diff)
downloadqemu-36af599417dde11747a27dc8550ff2281657a8ff.zip
qemu-36af599417dde11747a27dc8550ff2281657a8ff.tar.gz
qemu-36af599417dde11747a27dc8550ff2281657a8ff.tar.bz2
nbd: Close socket on negotiation failure.
Otherwise, the nbd client may hang waiting for the server response. Signed-off-by: Hani Benhabiles <hani@linux.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r--qemu-nbd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index eed79fa..f70e4b0 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -369,8 +369,10 @@ static void nbd_accept(void *opaque)
return;
}
- if (fd >= 0 && nbd_client_new(exp, fd, nbd_client_closed)) {
+ if (nbd_client_new(exp, fd, nbd_client_closed)) {
nb_fds++;
+ } else {
+ close(fd);
}
}