From patchwork Mon Oct 7 11:28:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 281077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 959682C00A7 for ; Mon, 7 Oct 2013 22:31:32 +1100 (EST) Received: from localhost ([::1]:58790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT92A-0007gv-7G for incoming@patchwork.ozlabs.org; Mon, 07 Oct 2013 07:31:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8zY-0003z5-J1 for qemu-devel@nongnu.org; Mon, 07 Oct 2013 07:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT8zS-0003Ie-K6 for qemu-devel@nongnu.org; Mon, 07 Oct 2013 07:28:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8zS-0003Ia-CJ for qemu-devel@nongnu.org; Mon, 07 Oct 2013 07:28:42 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r97BSeRt005699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Oct 2013 07:28:40 -0400 Received: from localhost (ovpn-112-38.ams2.redhat.com [10.36.112.38]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r97BScbG017549; Mon, 7 Oct 2013 07:28:39 -0400 From: Stefan Hajnoczi To: Date: Mon, 7 Oct 2013 13:28:04 +0200 Message-Id: <1381145289-6591-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1381145289-6591-1-git-send-email-stefanha@redhat.com> References: <1381145289-6591-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Stefan Hajnoczi , Dunrong Huang , Anthony Liguori Subject: [Qemu-devel] [PULL 3/8] block: use correct filename for error report 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 From: Dunrong Huang The content filename point to will be erased by qemu_opts_absorb_qdict() in raw_open_common() in drv->bdrv_file_open() So it's better to use bs->filename. Signed-off-by: Dunrong Huang Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 93e113a..e2d9936 100644 --- a/block.c +++ b/block.c @@ -808,8 +808,8 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, if (ret < 0) { if (error_is_set(&local_err)) { error_propagate(errp, local_err); - } else if (filename) { - error_setg_errno(errp, -ret, "Could not open '%s'", filename); + } else if (bs->filename[0]) { + error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename); } else { error_setg_errno(errp, -ret, "Could not open image"); }