qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: monitor: check for readline in monitor_event()
Date: Tue, 16 Jun 2009 00:42:26 +0200	[thread overview]
Message-ID: <4A36CE52.6020100@web.de> (raw)
In-Reply-To: <20090615173858.31514f4f@doriath>

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

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 <lcapitulino@redhat.com>
> ---
>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-06-15 22:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 20:38 [Qemu-devel] monitor: check for readline in monitor_event() Luiz Capitulino
2009-06-15 22:42 ` Jan Kiszka [this message]
2009-06-16 12:47   ` [Qemu-devel] " Luiz Capitulino
2009-06-16 15:46     ` Jan Kiszka
2009-06-16 16:04       ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A36CE52.6020100@web.de \
    --to=jan.kiszka@web.de \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).