From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm tools: Sanitize output characters in serial console Date: Thu, 11 Aug 2011 11:36:04 +0300 Message-ID: <4E439474.3080903@redhat.com> References: <1312934218-32666-1-git-send-email-asias.hejun@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Asias He Return-path: Received: from mx1.redhat.com ([209.132.183.28]:10438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253Ab1HKIgZ (ORCPT ); Thu, 11 Aug 2011 04:36:25 -0400 In-Reply-To: <1312934218-32666-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/10/2011 02:56 AM, Asias He wrote: > This patch fixes strange characters in serial console. > > Before: > > [ 0.448000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enable= d > =EF=BF=BD[ 0.695000] serial8250: ttyS0 at I/O 0x3f8 (irq =3D 0) is= a 16550A > =EF=BF=BD[ 0.942000] serial8250: ttyS1 at I/O 0x2f8 (irq =3D 0) is= a 16550A > =EF=BF=BD[ 1.189000] serial8250: ttyS2 at I/O 0x3e8 (irq =3D 0) is= a 16550A > [ 1.194000] Non-volatile memory driver v1.3 > > After: > > [ 0.541000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enable= d > [ 0.788000] serial8250: ttyS0 at I/O 0x3f8 (irq =3D 0) is a 16550A > [ 1.041000] serial8250: ttyS1 at I/O 0x2f8 (irq =3D 0) is a 16550A > [ 1.294000] serial8250: ttyS2 at I/O 0x3e8 (irq =3D 0) is a 16550A > [ 1.309000] Non-volatile memory driver v1.3 > > Signed-off-by: Asias He > --- > tools/kvm/term.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/kvm/term.c b/tools/kvm/term.c > index 2a3e1f0..85b41e7 100644 > --- a/tools/kvm/term.c > +++ b/tools/kvm/term.c > @@ -5,6 +5,7 @@ > #include > #include > #include > +#include > > #include "kvm/read-write.h" > #include "kvm/term.h" > @@ -57,8 +58,10 @@ int term_putc(int who, char *addr, int cnt) > if (who !=3D active_console) > return -1; > > - while (cnt--) > - fprintf(stdout, "%c", *addr++); > + while (cnt--) { > + if (isascii(*addr)) > + fprintf(stdout, "%c", *addr++); > + } > > fflush(stdout); > return cnt; This will likely kill UTF-8. --=20 error compiling committee.c: too many arguments to function