From patchwork Sat Dec 15 14:09:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 206623 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 B2A252C008D for ; Sun, 16 Dec 2012 01:41:52 +1100 (EST) Received: from localhost ([::1]:56177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjsRR-0000Ci-DO for incoming@patchwork.ozlabs.org; Sat, 15 Dec 2012 09:10:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjsR9-0008Qf-1L for qemu-devel@nongnu.org; Sat, 15 Dec 2012 09:09:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjsR6-0003Pj-KL for qemu-devel@nongnu.org; Sat, 15 Dec 2012 09:09:54 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:44091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjsR6-0003Pe-EB for qemu-devel@nongnu.org; Sat, 15 Dec 2012 09:09:52 -0500 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 0EA62728004A; Sat, 15 Dec 2012 15:09:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18dvQWMmBAuu; Sat, 15 Dec 2012 15:09:51 +0100 (CET) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id B6314728004B; Sat, 15 Dec 2012 15:09:51 +0100 (CET) From: Stefan Weil To: Stefan Hajnoczi , Kevin Wolf Date: Sat, 15 Dec 2012 15:09:31 +0100 Message-Id: <1355580573-19323-3-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355580573-19323-1-git-send-email-sw@weilnetz.de> References: <1355580573-19323-1-git-send-email-sw@weilnetz.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 78.47.199.172 Cc: Stefan Weil , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/4] block: Improve error report for wrong format 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 There is no good system error for this kind of error, so it needs special handling instead of strerror. Signed-off-by: Stefan Weil --- blockdev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 5a4cd56..3da44f6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -624,8 +624,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type) ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv); if (ret < 0) { - error_report("could not open disk image %s: %s", - file, strerror(-ret)); + if (ret == BDRV_WRONG_FORMAT) { + error_report("could not open disk image %s: not in %s format", + file, drv->format_name); + } else { + error_report("could not open disk image %s: %s", + file, strerror(-ret)); + } goto err; }