diff options
-rw-r--r-- | include/char/char.h | 1 | ||||
-rw-r--r-- | qemu-char.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/char/char.h b/include/char/char.h index e9d2c108a8..dbb1b89f8c 100644 --- a/include/char/char.h +++ b/include/char/char.h @@ -75,6 +75,7 @@ struct CharDriverState { char *label; char *filename; int be_open; + int fe_open; int avail_connections; QemuOpts *opts; QTAILQ_ENTRY(CharDriverState) next; diff --git a/qemu-char.c b/qemu-char.c index 345fd67fca..c9890ad20f 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3412,6 +3412,10 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo) void qemu_chr_fe_open(struct CharDriverState *chr) { + if (chr->fe_open) { + return; + } + chr->fe_open = 1; if (chr->chr_guest_open) { chr->chr_guest_open(chr); } @@ -3419,6 +3423,10 @@ void qemu_chr_fe_open(struct CharDriverState *chr) void qemu_chr_fe_close(struct CharDriverState *chr) { + if (!chr->fe_open) { + return; + } + chr->fe_open = 0; if (chr->chr_guest_close) { chr->chr_guest_close(chr); } |