Blob Blame Raw
From bde3157fa573b77a573a248ed27a7ad6974a329e Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Thu, 23 Jan 2014 21:02:38 +0100
Subject: [PATCH 14/14] block: use correct filename for error report

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <8724e61ff2600d6daa9a50e4e920e35e658d252b.1390510896.git.jcody@redhat.com>
Patchwork-id: 56934
O-Subject: [RHEL7 qemu-kvm PATCH] block: use correct filename for error report
Bugzilla: 1051438
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

From: Dunrong Huang <riegamaths@gmail.com>

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 <riegamaths@gmail.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 2fa9aa59cfc472c16309c4e84547aa873423b2f5)

RHEL7 Notes:
    BZ:   1051438
    Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6926450

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index 3232971..1433844 100644
--- a/block.c
+++ b/block.c
@@ -783,8 +783,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");
         }
-- 
1.7.1