From patchwork Tue Sep 24 10:14:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dunrong huang X-Patchwork-Id: 277422 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 9BB9D2C00B7 for ; Tue, 24 Sep 2013 20:14:46 +1000 (EST) Received: from localhost ([::1]:44771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOPdj-00026x-ON for incoming@patchwork.ozlabs.org; Tue, 24 Sep 2013 06:14:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOPdJ-00025o-AC for qemu-devel@nongnu.org; Tue, 24 Sep 2013 06:14:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOPd9-0006CH-W9 for qemu-devel@nongnu.org; Tue, 24 Sep 2013 06:14:17 -0400 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:55788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOPd9-0006By-PK for qemu-devel@nongnu.org; Tue, 24 Sep 2013 06:14:07 -0400 Received: by mail-pa0-f47.google.com with SMTP id kp14so3456899pab.20 for ; Tue, 24 Sep 2013 03:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=y/bYAyN8ElPxyWufprrTwGZxBXuUl+IAiqbku+7pIiw=; b=nC93LgyOZB9wZv1K/Yk6KH8PdCqumGBvvLcgXeZfZzvb/1zg4SbFQXlsJyLbEg7IR7 i5DK0fUOhAzGmdv1inceJciZLF48FZ+Z2vmhJMoXqoUzf5KWLV7lNpy/sO4iSCgDjit+ nF7yNu3S/G0FmxjNLz47S0WgahzT52GQ0SA/8RpVoLv3Hb8HyXBJAc5AXQfVn3T0v54g 7YzvxM7UCCQ4DtK00JqXDDpGgpHDsfgqHTIiMtBnfKOXE+PabmFz/RvbNm0xe/MEQpaF +NGZ4xcASBEZwVxzqAM/WincaH6nERHWMGBNkPkTn0WKbV/thsOqG9Tln5u8dUr79Ibf kyVg== X-Received: by 10.66.154.1 with SMTP id vk1mr27478420pab.85.1380017646643; Tue, 24 Sep 2013 03:14:06 -0700 (PDT) Received: from riegamaths@gmail.com ([221.122.32.18]) by mx.google.com with ESMTPSA id aq1sm10004465pbc.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Sep 2013 03:14:06 -0700 (PDT) Received: by riegamaths@gmail.com (sSMTP sendmail emulation); Tue, 24 Sep 2013 18:14:01 +0800 From: Dunrong Huang To: qemu-devel Date: Tue, 24 Sep 2013 18:14:01 +0800 Message-Id: <1380017641-29820-1-git-send-email-riegamaths@gmail.com> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22f Cc: Kevin Wolf , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] 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 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 --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index ea4956d..9cd78a1 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"); }