block: use correct filename for error report
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
@@ -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
Quoted 9 lines · Dunrong Huang
The content filename point to will be erased by
qemu_opts_absorb_qdict()inraw_open_common()indrv->bdrv_file_open()So it's better to use
bs->filename.Signed-off-by Dunrong Huang <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ping?
Quoted 15 lines · Max Reitz
Quoted 10 lines · Dunrong Huang
The content filename point to will be erased by
qemu_opts_absorb_qdict()inraw_open_common()indrv->bdrv_file_open()So it's better to use
bs->filename.Signed-off-by Dunrong Huang <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Reviewed-by Max Reitz <[email protected]>
Signature · 5 lines
Best Regards, Dunrong Huang Homepage: http://mathslinux.org
Stefan Hajnoczi
AppliedQuoted 9 lines · Dunrong Huang
The content filename point to will be erased by
qemu_opts_absorb_qdict()inraw_open_common()indrv->bdrv_file_open()So it's better to use
bs->filename.Signed-off-by Dunrong Huang <[email protected]>--- 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
Quoted 13 lines · Stefan Hajnoczi
Quoted 9 lines · Dunrong Huang
The content filename point to will be erased by
qemu_opts_absorb_qdict()inraw_open_common()indrv->bdrv_file_open()So it's better to use
bs->filename.Signed-off-by Dunrong Huang <[email protected]>--- 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/blockStefan
Signature · 5 lines
Best Regards, Dunrong Huang Homepage: http://mathslinux.org