From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGKsr-0007sm-OU for qemu-devel@nongnu.org; Mon, 15 Jun 2009 18:42:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGKsn-0007qz-4N for qemu-devel@nongnu.org; Mon, 15 Jun 2009 18:42:33 -0400 Received: from [199.232.76.173] (port=47355 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGKsm-0007qt-VN for qemu-devel@nongnu.org; Mon, 15 Jun 2009 18:42:29 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:50240) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGKsm-0004TJ-Bq for qemu-devel@nongnu.org; Mon, 15 Jun 2009 18:42:28 -0400 Message-ID: <4A36CE52.6020100@web.de> Date: Tue, 16 Jun 2009 00:42:26 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20090615173858.31514f4f@doriath> In-Reply-To: <20090615173858.31514f4f@doriath> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7D3DDC190B56C0BD409615D8" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: monitor: check for readline in monitor_event() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7D3DDC190B56C0BD409615D8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. >=20 > This fixes the problem by adding the proper check. >=20 > 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. >=20 > Signed-off-by: Luiz Capitulino > --- > monitor.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) >=20 > 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 =3D=3D 0) > + if (mon->rs && mon->chr->focus =3D=3D 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 --------------enig7D3DDC190B56C0BD409615D8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAko2zlIACgkQniDOoMHTA+nvVgCfawGa8H+n++FrJBtrA+LSj47t 9UUAnAqqKwmp++KFRvQe5VmmIiWYVjTr =FRWb -----END PGP SIGNATURE----- --------------enig7D3DDC190B56C0BD409615D8--