diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 18dc528761adf89663e338b604caedba716bb6c4..b3a24740b2dbc8f66b84955a125f05ac102ff860 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); } } diff --git a/qemu-nbd.c b/qemu-nbd.c index ba6043680a31e5408a73bfb435c570d7e0cac0bf..626e5844f9bd167dda5a8f46722c1c4c8b0572de 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -372,6 +372,7 @@ static void nbd_accept(void *opaque) if (nbd_client_new(exp, fd, nbd_client_closed)) { nb_fds++; } else { + shutdown(fd, 2); close(fd); } }