diff options
-rw-r--r-- | qemu-nbd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c index eb61c33acd..e189cf86f4 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -429,7 +429,7 @@ int main(int argc, char **argv) pid = fork(); if (pid == 0) { close(stderr_fd[0]); - ret = qemu_daemon(0, 0); + ret = qemu_daemon(1, 0); /* Temporarily redirect stderr to the parent's pipe... */ dup2(stderr_fd[1], STDERR_FILENO); @@ -527,6 +527,12 @@ int main(int argc, char **argv) qemu_set_fd_handler2(fd, nbd_can_accept, nbd_accept, NULL, (void *)(uintptr_t)fd); + /* now when the initialization is (almost) complete, chdir("/") + * to free any busy filesystems */ + if (chdir("/") < 0) { + err(EXIT_FAILURE, "Could not chdir to root directory"); + } + do { main_loop_wait(false); } while (!sigterm_reported && (persistent || !nbd_started || nb_fds > 0)); |