]> git.proxmox.com Git - mirror_qemu.git/blobdiff - chardev/char-stdio.c
qcow2: Allow -o compat=v3 during qemu-img amend
[mirror_qemu.git] / chardev / char-stdio.c
index 96375f2ab886c87500d856027a791fa15c0d002d..82eaebc1db6528b9238455d0ae3710134abaebee 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/module.h"
 #include "qemu/option.h"
 #include "qemu/sockets.h"
 #include "qapi/error.h"
@@ -46,8 +47,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)