On 2/17/20 11:13 AM, Peter Krempa wrote:
The path can be NULL e.g. for NBD disks. Use NULLSTR to prevent use of NULL in %s. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/util/virstoragefile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f8e4102588..cf37744d6f 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4973,7 +4973,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, g_autoptr(virStorageSource) backingStore = NULL; VIR_DEBUG("path=%s format=%d uid=%u gid=%u", - src->path, src->format, + NULLSTR(src->path), src->format, (unsigned int)uid, (unsigned int)gid);
Here, it matters in log output;
/* exit if we can't load information about the current image */ @@ -4995,7 +4995,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, if (virHashLookup(cycle, uniqueName)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("backing store for %s (%s) is self-referential"), - src->path, uniqueName); + NULLSTR(src->path), uniqueName);
here, we're less likely to see the message. But being consistent is worthwhile.
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org