summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2012-12-30 12:48:14 +0400
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-02 13:32:41 -0600
commitab51b1d568e02c80b1abf9016bda3a86dc1db389 (patch)
treecac5c53f509b8453f876253b96877fdea299f6cd /qemu-char.c
parent217da7fdeb2a4c99c49f22f9dc64c8df2e3a4387 (diff)
downloadhqemu-ab51b1d568e02c80b1abf9016bda3a86dc1db389.zip
hqemu-ab51b1d568e02c80b1abf9016bda3a86dc1db389.tar.gz
disallow -daemonize usage of stdio (curses display, -nographic, -serial stdio etc)
Curses display requires stdin/out to stay on the terminal, so -daemonize makes no sense in this case. Instead of leaving display uninitialized like is done since 995ee2bf469de6bb, explicitly detect this case earlier and error out. -nographic can actually be used with -daemonize, by redirecting everything to a null device, but the problem is that according to documentation and historical behavour, -nographic redirects guest ports to stdin/out, which, again, makes no sense in case of -daemonize. Since -nographic is a legacy option, don't bother fixing this case (to allow -nographic and -daemonize by redirecting guest ports to null instead of stdin/out in this case), but disallow it completely instead, to stop garbling host terminal. If no display display needed and user wants to use -nographic, the right way to go is to use -serial null -parallel null -monitor none -display none -vga none instead of -nographic. Also prevent the same issue -- it was possible to get garbled host tty after -nographic -daemonize and it is still possible to have it by using -serial stdio -daemonize Fix this by disallowing opening stdio chardev when -daemonize is specified. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index c6382a9..331ad5c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -772,6 +772,10 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {
return NULL;
}
+ if (is_daemonized()) {
+ error_report("cannot use stdio with -daemonize");
+ return NULL;
+ }
if (stdio_nb_clients == 0) {
old_fd0_flags = fcntl(0, F_GETFL);
tcgetattr (0, &oldtty);
OpenPOWER on IntegriCloud