Skip to contentSkip to conversation

block: use correct filename for error report

PATCH Applied Dunrong Huang 3 participants 5 messages Sep 24, 2013 – Oct 2, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: use correct filename for error report

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.

---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block.c +2 -2
index ea4956d..9cd78a1 100644
@@ -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");
         }
Signature · 1 line
1.8.3.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · 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.

---
  block.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
#2 lore raw

ping?

Quoted 15 lines · Max Reitz
Quoted 10 lines · 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.

---
  block.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 5 lines
Best Regards,

Dunrong Huang

Homepage: http://mathslinux.org
#3 lore raw
In reply to Dunrong Huang
Quoted 9 lines · 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.

---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

The same issue affects the rest of the function:

#ifndef _WIN32
    if (bs->is_temporary) {
        assert(filename != NULL);
        unlink(filename);
    }

#endif

Do you want to send a separate patch to fix this?

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

#4 lore raw
Quoted 13 lines · Stefan Hajnoczi
Quoted 9 lines · 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.

---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

The same issue affects the rest of the function:

Quoted 9 lines
#ifndef _WIN32
    if (bs->is_temporary) {
        assert(filename != NULL);
        unlink(filename);
    }

#endif

Do you want to send a separate patch to fix this?

Sure.

Quoted 6 lines

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Signature · 5 lines
Best Regards,

Dunrong Huang

Homepage: http://mathslinux.org