diff options
-rw-r--r-- | chardev/char-stdio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/chardev/char-stdio.c b/chardev/char-stdio.c index 96375f2ab8..9624220e6d 100644 --- a/chardev/char-stdio.c +++ b/chardev/char-stdio.c @@ -46,8 +46,10 @@ static bool stdio_echo_state; static void term_exit(void) { - tcsetattr(0, TCSANOW, &oldtty); - fcntl(0, F_SETFL, old_fd0_flags); + if (stdio_in_use) { + tcsetattr(0, TCSANOW, &oldtty); + fcntl(0, F_SETFL, old_fd0_flags); + } } static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) |