提交 45673671 编写于 作者: K Kevin Wolf 提交者: Anthony Liguori

block: Fix build with tracing enabled

filename was still uninitialised when it's used as a parameter to a
tracing function, so let's move the initialisation. Also, commit c2ad1b0c
forgot to add a NULL check, which this patch adds while we're at it.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Tested-by: NAndreas Färber <afaerber@suse.de>
Message-id: 1366645720-11384-1-git-send-email-kwolf@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 8e36d6ca
...@@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, ...@@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
assert(bs->file == NULL); assert(bs->file == NULL);
assert(options != NULL && bs->options != options); 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)) { if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) {
return -ENOTSUP; return -ENOTSUP;
...@@ -698,12 +704,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, ...@@ -698,12 +704,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
bdrv_enable_copy_on_read(bs); bdrv_enable_copy_on_read(bs);
} }
if (file != NULL) {
filename = file->filename;
} else {
filename = qdict_get_try_str(options, "filename");
}
if (filename != NULL) { if (filename != NULL) {
pstrcpy(bs->filename, sizeof(bs->filename), filename); pstrcpy(bs->filename, sizeof(bs->filename), filename);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册