diff options
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qemu-char.c b/qemu-char.c index a3d6e64967..c02dfae43a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -713,9 +713,15 @@ static void term_exit(void) fcntl(0, F_SETFL, old_fd0_flags); } +static void term_exit_notifier(Notifier *notifier) +{ + term_exit(); +} + static void term_init(QemuOpts *opts) { struct termios tty; + static Notifier exit_notifier = { .notify = term_exit_notifier }; tcgetattr (0, &tty); oldtty = tty; @@ -735,8 +741,9 @@ static void term_init(QemuOpts *opts) tcsetattr (0, TCSANOW, &tty); - if (!term_atexit_done++) - atexit(term_exit); + if (!term_atexit_done++) { + exit_notifier_add(&exit_notifier); + } fcntl(0, F_SETFL, O_NONBLOCK); } |