From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/5] qemu-nbd: Do not close stderr
Date: Wed, 8 May 2019 15:22:07 +0200 [thread overview]
Message-ID: <20190508132209.17707-4-mreitz@redhat.com> (raw)
In-Reply-To: <20190508132209.17707-1-mreitz@redhat.com>
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 <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
qemu-nbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 4866042160..62c547a363 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -1015,10 +1015,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.20.1
next prev parent reply other threads:[~2019-05-08 13:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 13:22 [Qemu-devel] [PATCH v2 0/5] iotests: Let 233 run concurrently Max Reitz
2019-05-08 13:22 ` [Qemu-devel] [PATCH v2 1/5] qemu-nbd: Add --pid-file option Max Reitz
2019-05-08 20:45 ` Max Reitz
2019-05-08 13:22 ` [Qemu-devel] [PATCH v2 2/5] iotests.py: Add qemu_nbd_early_pipe() Max Reitz
2019-05-08 13:22 ` Max Reitz [this message]
2019-05-08 13:22 ` [Qemu-devel] [PATCH v2 4/5] iotests: Use qemu-nbd's --pid-file Max Reitz
2019-05-08 13:22 ` [Qemu-devel] [PATCH v2 5/5] iotests: Let 233 run concurrently Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190508132209.17707-4-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).