From patchwork Tue Aug 9 23:56:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 1051432 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p79Nvd4A031165 for ; Tue, 9 Aug 2011 23:57:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751861Ab1HIX5g (ORCPT ); Tue, 9 Aug 2011 19:57:36 -0400 Received: from mail-yi0-f46.google.com ([209.85.218.46]:64855 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393Ab1HIX5f (ORCPT ); Tue, 9 Aug 2011 19:57:35 -0400 Received: by yie30 with SMTP id 30so367079yie.19 for ; Tue, 09 Aug 2011 16:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=JaQ6Yj0jprTjCEtCoQlW3i4IBXKthy8zT6lvRqTchiI=; b=mfwPSgO+sHeLN4U31yarSzRsTQEfyLBLo49GRfnmuMSBqNn46gSRqeykqWF1dKdIZb bjZ2n40JcBHa1yfkK5JveM4JUGbjGo9CzdrBZ3K9cXOYR7koQBiYcQ4UIOI5NcRKXyeX DRpYVVLVWkTZ9gRdDNN//Mpk5xEjYeF3zZ1Lo= Received: by 10.142.247.33 with SMTP id u33mr2582514wfh.297.1312934254710; Tue, 09 Aug 2011 16:57:34 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id l7sm358411pbh.90.2011.08.09.16.57.31 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Aug 2011 16:57:33 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org, Asias He Subject: [PATCH] kvm tools: Sanitize output characters in serial console Date: Wed, 10 Aug 2011 07:56:58 +0800 Message-Id: <1312934218-32666-1-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 09 Aug 2011 23:57:39 +0000 (UTC) This patch fixes strange characters in serial console. Before: [ 0.448000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled ?[ 0.695000] serial8250: ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A ?[ 0.942000] serial8250: ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A ?[ 1.189000] serial8250: ttyS2 at I/O 0x3e8 (irq = 0) is a 16550A [ 1.194000] Non-volatile memory driver v1.3 After: [ 0.541000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 0.788000] serial8250: ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A [ 1.041000] serial8250: ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A [ 1.294000] serial8250: ttyS2 at I/O 0x3e8 (irq = 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 != active_console) return -1; - while (cnt--) - fprintf(stdout, "%c", *addr++); + while (cnt--) { + if (isascii(*addr)) + fprintf(stdout, "%c", *addr++); + } fflush(stdout); return cnt;