diff options
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r-- | qemu-nbd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c index eed79fa15e..cd6bd50fae 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -294,7 +294,7 @@ static void *nbd_client_thread(void *arg) fd = open(device, O_RDWR); if (fd < 0) { /* Linux-only, we can use %m in printf. */ - fprintf(stderr, "Failed to open %s: %m", device); + fprintf(stderr, "Failed to open %s: %m\n", device); goto out_socket; } @@ -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); } } |