From patchwork Tue Feb 7 14:09:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 139951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6B6451007D3 for ; Wed, 8 Feb 2012 02:26:08 +1100 (EST) Received: from localhost ([::1]:33778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RulkU-0002aK-A3 for incoming@patchwork.ozlabs.org; Tue, 07 Feb 2012 09:10:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:53913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljp-0001Uv-Do for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruljf-0005fU-I3 for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:41 -0500 Received: from oxygen.pond.sub.org ([78.46.104.156]:39190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljf-0005ea-DG for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:31 -0500 Received: from blackfin.pond.sub.org (p5B32D218.dip.t-dialin.net [91.50.210.24]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 05970A43F7; Tue, 7 Feb 2012 15:09:29 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 6F1886008B; Tue, 7 Feb 2012 15:09:27 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 7 Feb 2012 15:09:19 +0100 Message-Id: <1328623766-12287-13-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1328623766-12287-1-git-send-email-armbru@redhat.com> References: <1328623766-12287-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 Cc: kwolf@redhat.com, aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 12/19] qemu-char: Chardev open error reporting, tty part 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 Unlike many other backends, this one leaves open error reporting to its caller. Because the caller doesn't know what went wrong, this results in a pretty useless error message. Change it to report its errors. Improves user-hostile messages like this one for "-chardev tty,id=foo,path=/dev/ttyy1" chardev: opening backend "file" failed to qemu-system-x86_64: -chardev tty,id=foo,path=/dev/ttyy1: Can't open '/dev/ttyy1': No such file or directory chardev: opening backend "file" failed The useless "opening backend failed" message will be cleaned up shortly. Signed-off-by: Markus Armbruster --- qemu-char.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 130ed8b..1ff7f4b 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1231,8 +1231,14 @@ static CharDriverState *qemu_chr_open_tty(QemuOpts *opts) CharDriverState *chr; int fd; + if (!filename) { + error_report("tty character device requires parameter path"); + return NULL; + } + TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK)); if (fd < 0) { + error_report("Can't open '%s': %s", filename, strerror(errno)); return NULL; } tty_serial_init(fd, 115200, 'N', 8, 1);