[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: monitor: check for readline in monitor_event()
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] Re: monitor: check for readline in monitor_event() |
Date: |
Tue, 16 Jun 2009 00:42:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
Luiz Capitulino wrote:
> The call of readline_show_prompt() in CHR_EVENT_RESET's body will
> trig a segfault if readline is not being used, because 'mon->rs'
> will be NULL.
>
> This fixes the problem by adding the proper check.
>
> I've trigged this while playing with an off-tree code that disables
> readline support, I'm not sure whether in-tree code can trig this.
>
> Signed-off-by: Luiz Capitulino <address@hidden>
> ---
> monitor.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 6b45f6c..787101d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3002,7 +3002,7 @@ static void monitor_event(void *opaque, int event)
> case CHR_EVENT_RESET:
> monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
> "information\n", QEMU_VERSION);
> - if (mon->chr->focus == 0)
> + if (mon->rs && mon->chr->focus == 0)
> readline_show_prompt(mon->rs);
> break;
> }
In-tree code is not affected as no monitor user will call qemu_chr_reset
for the associated char device if there is no readline active as well.
Yeah, secret de-facto rule.
The patch is not incorrect, but I would like to understand the
out-of-tree use case behind it. So you do want the info line printed,
but provide your own readline processor? What kind of terminal is this?
Jan
signature.asc
Description: OpenPGP digital signature