aboutsummaryrefslogtreecommitdiff
path: root/blockdev-nbd.c
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-05-31 22:39:42 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2014-06-30 12:50:12 +0200
commit27e5eae4577316f7e86a56eb7363d4e78f79e3e5 (patch)
tree0b9cb3ee01251283aa32f48f19491240a80aafeb /blockdev-nbd.c
parent8c5d1abbb79193dca8e4823ef53d8d1e650362ae (diff)
nbd: Shutdown socket before closing.
This forces finishing data sending to client before closing the socket like in exports listing or replying with NBD_REP_ERR_UNSUP cases. Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'blockdev-nbd.c')
-rw-r--r--blockdev-nbd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 18dc528761..b3a24740b2 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -28,6 +28,7 @@ static void nbd_accept(void *opaque)
int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);
if (fd >= 0 && !nbd_client_new(NULL, fd, nbd_client_put)) {
+ shutdown(fd, 2);
close(fd);
}
}