mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
qemu-nbd: Do not close stderr
We kept old_stderr specifically so we could keep emitting error message on stderr. However, qemu_daemon() closes stderr. Therefore, we need to dup() stderr to old_stderr before invoking qemu_daemon(). Signed-off-by: Max Reitz <[email protected]> Reviewed-by: Eric Blake <[email protected]> Message-Id: <[email protected]> Signed-off-by: Eric Blake <[email protected]>
This commit is contained in:
1 parent
6177b58431
commit
e6df58a557
1 file changed
+2
-1
+2
-1
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user