Patchwork [PULL,3/8] block: use correct filename for error report

login
register
mail settings
Submitter Stefan Hajnoczi
Date Oct. 7, 2013, 11:28 a.m.
Message ID <1381145289-6591-4-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/281077/
State New
Headers show

Comments

Stefan Hajnoczi - Oct. 7, 2013, 11:28 a.m.
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>
---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

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");
         }