From patchwork Mon Jul 9 14:28:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 169860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1E8B62C0203 for ; Tue, 10 Jul 2012 00:28:58 +1000 (EST) Received: from localhost ([::1]:40669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoExL-0007zB-T7 for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2012 10:28:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoEx9-0007y6-0a for qemu-devel@nongnu.org; Mon, 09 Jul 2012 10:28:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoEx2-0004Rp-Ip for qemu-devel@nongnu.org; Mon, 09 Jul 2012 10:28:42 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:35004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoEx2-0004Ni-7C for qemu-devel@nongnu.org; Mon, 09 Jul 2012 10:28:36 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SoEww-0007XU-Uq; Mon, 09 Jul 2012 15:28:30 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2012 15:28:30 +0100 Message-Id: <1341844110-28957-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: =?UTF-8?q?Christian=20M=C3=BCller?= , Anthony Liguori , patches@linaro.org Subject: [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The qemu_chr_new() function doesn't set errno on failure, so don't print strerror(errno) on the error handling path when dealing with the -serial, -parallel and -virtioconsole arguments. This avoids nonsensical error messages like: $ ./arm-softmmu/qemu-system-arm -serial wombat qemu: could not open serial device 'wombat': Success We also rephrase the message slightly to make it a little clearer that we're expecting the name of a QEMU chr backend rather than a host or guest serial/parallel/etc device. Reported-by: Christian Müller Signed-off-by: Peter Maydell --- vl.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 1329c30..8d49ff0 100644 --- a/vl.c +++ b/vl.c @@ -1985,8 +1985,8 @@ static int serial_parse(const char *devname) snprintf(label, sizeof(label), "serial%d", index); serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { - fprintf(stderr, "qemu: could not open serial device '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect serial device" + " to character backend '%s'\n", devname); return -1; } index++; @@ -2007,8 +2007,8 @@ static int parallel_parse(const char *devname) snprintf(label, sizeof(label), "parallel%d", index); parallel_hds[index] = qemu_chr_new(label, devname, NULL); if (!parallel_hds[index]) { - fprintf(stderr, "qemu: could not open parallel device '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect parallel device" + " to character backend '%s'\n", devname); return -1; } index++; @@ -2042,8 +2042,8 @@ static int virtcon_parse(const char *devname) snprintf(label, sizeof(label), "virtcon%d", index); virtcon_hds[index] = qemu_chr_new(label, devname, NULL); if (!virtcon_hds[index]) { - fprintf(stderr, "qemu: could not open virtio console '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect virtio console" + " to character backend '%s'\n", devname); return -1; } qemu_opt_set(dev_opts, "chardev", label);