[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v3 3/5] qemu-nbd: Do not close stderr
From: |
Max Reitz |
Subject: |
[Qemu-block] [PATCH v3 3/5] qemu-nbd: Do not close stderr |
Date: |
Wed, 8 May 2019 23:18:18 +0200 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
qemu-nbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index edb5195208..e4446d479c 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -1014,10 +1014,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));
--
2.21.0
- [Qemu-block] [PATCH v3 0/5] iotests: Let 233 run concurrently, Max Reitz, 2019/05/08
- [Qemu-block] [PATCH v3 1/5] qemu-nbd: Add --pid-file option, Max Reitz, 2019/05/08
- [Qemu-block] [PATCH v3 2/5] iotests.py: Add qemu_nbd_early_pipe(), Max Reitz, 2019/05/08
- [Qemu-block] [PATCH v3 3/5] qemu-nbd: Do not close stderr,
Max Reitz <=
- [Qemu-block] [PATCH v3 4/5] iotests: Use qemu-nbd's --pid-file, Max Reitz, 2019/05/08
- [Qemu-block] [PATCH v3 5/5] iotests: Let 233 run concurrently, Max Reitz, 2019/05/08
- Re: [Qemu-block] [PATCH v3 0/5] iotests: Let 233 run concurrently, Eric Blake, 2019/05/24