aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qemu-nbd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 99377a3f14..a8cb39e510 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -1004,10 +1004,11 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
} else if (pid == 0) {
close(stderr_fd[0]);
+
+ old_stderr = dup(STDERR_FILENO);
ret = qemu_daemon(1, 0);
/* Temporarily redirect stderr to the parent's pipe... */
- old_stderr = dup(STDERR_FILENO);
dup2(stderr_fd[1], STDERR_FILENO);
if (ret < 0) {
error_report("Failed to daemonize: %s", strerror(errno));