aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/block.c b/block.c
index 819eb4e009..aa9a533355 100644
--- a/block.c
+++ b/block.c
@@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
assert(bs->file == NULL);
assert(options != NULL && bs->options != options);
- trace_bdrv_open_common(bs, filename, flags, drv->format_name);
+ if (file != NULL) {
+ filename = file->filename;
+ } else {
+ filename = qdict_get_try_str(options, "filename");
+ }
+
+ trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) {
return -ENOTSUP;
@@ -698,12 +704,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
bdrv_enable_copy_on_read(bs);
}
- if (file != NULL) {
- filename = file->filename;
- } else {
- filename = qdict_get_try_str(options, "filename");
- }
-
if (filename != NULL) {
pstrcpy(bs->filename, sizeof(bs->filename), filename);
} else {