If stdin is is a char backend device, then restore original stdin terminal
settings in before re-exec'ing. Otherwise, the new qemu sees the modified
settings as initial settings, and does not restore the true initial settings
when it exits.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
chardev/char-stdio.c | 7 +++++++
include/chardev/char.h | 2 ++
migration/savevm.c | 2 ++
3 files changed, 11 insertions(+)
diff --git a/chardev/char-stdio.c b/chardev/char-stdio.c
index 82eaebc..6481d08 100644
--- a/chardev/char-stdio.c
+++ b/chardev/char-stdio.c
@@ -119,6 +119,13 @@ static void qemu_chr_open_stdio(Chardev *chr,
}
#endif
+void qemu_term_exit(void)
+{
+#ifndef _WIN32
+ term_exit();
+#endif
+}
+
static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
Error **errp)
{
diff --git a/include/chardev/char.h b/include/chardev/char.h
index c18bda8..5fd3ecc 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -296,4 +296,6 @@ void save_char_socket_fd(Chardev *);
void load_char_socket_fd(Chardev *);
void save_char_pty_fd(Chardev *);
+void qemu_term_exit(void);
+
#endif
diff --git a/migration/savevm.c b/migration/savevm.c
index 732dfb5..881dc13 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -32,6 +32,7 @@
#include "migration.h"
#include "migration/snapshot.h"
#include "migration/vmstate.h"
+#include "chardev/char.h"
#include "migration/misc.h"
#include "migration/register.h"
#include "migration/global_state.h"
@@ -2772,6 +2773,7 @@ void save_cpr_snapshot(const char *file, const char *mode, Error **errp)
walkenv(FD_PREFIX, preserve_fd, 0);
reset_vhost_devices();
save_qmp_negotiation_status();
+ qemu_term_exit();
qemu_system_exec_request();
putenv((char *)"QEMU_START_FREEZE=");
}
--
1.8.3.1