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: 9900 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 454F523E57 for ; Mon, 9 Jul 2012 14:28:38 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 14079A18424 for ; Mon, 9 Jul 2012 14:28:37 +0000 (UTC) Received: by yhpp61 with SMTP id p61so11698823yhp.11 for ; Mon, 09 Jul 2012 07:28:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=vjWxy4njPMLiLrZg/ZApMg4jAEcMyUF0nTrzSYJfh3I=; b=Y42N1vTUnaNRhJLK1mFmikNKcOy0OSfAQzCsQYqVQ3VIa/+PKdKy4VYXvt3Hp05Zbu 3jvrMBHKL7UPXr+f5DiW9BFGxVomNuH49YAJM0wLQ0PYh10FS6yHQiQSe2VwjmVO/N3g QRHCyrOZOGH/mECdOGHi6Z2gq+lvJe8FmwmgZRrmrFI2viPZLSssNPu0eR+abIbbHJrZ O+DQZdQj94glCALDnTn/e1bMRSIQgslJ2J5N5L2QmvrpP9ew/ebAhXm//U0BtpQIf/X8 ZLKqgl2D08PRwgXr+EYbJokbnswNvGJZ5ghVP4FPyWQ9/42FstP6hqS9jODWaddA9Vwv XOZA== Received: by 10.50.163.99 with SMTP id yh3mr8373527igb.53.1341844117158; Mon, 09 Jul 2012 07:28:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp36784ibb; Mon, 9 Jul 2012 07:28:36 -0700 (PDT) Received: by 10.216.142.200 with SMTP id i50mr17568006wej.47.1341844115886; Mon, 09 Jul 2012 07:28:35 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id y55si32314948wel.156.2012.07.09.07.28.35 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 07:28:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk 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 Cc: patches@linaro.org, =?UTF-8?q?Christian=20M=C3=BCller?= , Anthony Liguori Subject: [PATCH] vl.c: Don't print errno after failed qemu_chr_new() 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-Gm-Message-State: ALoCoQkp5z0Sc+pG0vXYAGBdpepf6IMYQhE2EBvljCcfsisyXH3qSwJN4NNcGmwTb3XBdnKaHsfN 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);