diff mbox

QEMU monitor banner printed multiple times

Message ID CAJ+F1CK65D9PyY0LqA_m24k0j4FptRcK7Br71Pip1rBOxCVrnA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau April 25, 2018, 10:12 a.m. UTC
Hi

On Wed, Apr 25, 2018 at 7:36 AM, Thomas Huth <thuth@redhat.com> wrote:
>  Hi,
>
> I just noticed that sometimes, the QEMU monitor banner is printed
> multiple times when you press "CTRL-a c" to enter the monitor:
>
> $ x86_64-softmmu/qemu-system-x86_64 -no-shutdown -nographic \
>     -nodefaults - mon:stdio
> QEMU 2.12.0 monitor - type 'help' for more information
> QEMU 2.12.0 monitor - type 'help' for more information
> QEMU 2.12.0 monitor - type 'help' for more information
> QEMU 2.12.0 monitor - type 'help' for more information
> (qemu) q
> QEMU 2.12.0 monitor - type 'help' for more information
> (qemu)
> $
>
> That looks quite ugly. Anybody got an idea how to fix this?

virtio console creates many extra events.

It's not so trivial to fix given how mux works.

What seems easy and probably safe is the following change:
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 39f8ee17ba..6f4646bf0c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4411,8 +4411,10 @@  static void monitor_event(void *opaque, int event)
         break;

     case CHR_EVENT_OPENED:
-        monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
-                       "information\n", QEMU_VERSION);
+        if (!mon->reset_seen) {
+            monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
+                           "information\n", QEMU_VERSION);
+        }


-- 
Marc-André Lureau