From 456736710df19c2275192269fe67a3f0b2583835 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 22 Apr 2013 17:48:40 +0200 Subject: block: Fix build with tracing enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Kevin Wolf Reviewed-by: Eric Blake Tested-by: Andreas Färber Message-id: 1366645720-11384-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori --- block.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'block.c') 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 { -- cgit v1.2.1