a41c76
From b501151fe2fb1f3b3e8d9617fb1b5a160832f480 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <b501151fe2fb1f3b3e8d9617fb1b5a160832f480@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Fri, 28 Feb 2020 10:24:31 +0100
a41c76
Subject: [PATCH] virStorageFileGetMetadataRecurse: Expect NULL src->path
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
The path can be NULL e.g. for NBD disks. Use NULLSTR to prevent use of
a41c76
NULL in %s.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit 157b8722cbcc57103d3dd9211aa94a2c592849b6)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
a41c76
Message-Id: <6f8aa7a68bbde2e405c83c53ee78e746d3efbf39.1582881363.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/util/virstoragefile.c | 4 ++--
a41c76
 1 file changed, 2 insertions(+), 2 deletions(-)
a41c76
a41c76
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
a41c76
index 911f811ace..28d1d1aa1e 100644
a41c76
--- a/src/util/virstoragefile.c
a41c76
+++ b/src/util/virstoragefile.c
a41c76
@@ -4973,7 +4973,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
a41c76
     g_autoptr(virStorageSource) backingStore = NULL;
a41c76
 
a41c76
     VIR_DEBUG("path=%s format=%d uid=%u gid=%u",
a41c76
-              src->path, src->format,
a41c76
+              NULLSTR(src->path), src->format,
a41c76
               (unsigned int)uid, (unsigned int)gid);
a41c76
 
a41c76
     /* exit if we can't load information about the current image */
a41c76
@@ -4995,7 +4995,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
a41c76
     if (virHashLookup(cycle, uniqueName)) {
a41c76
         virReportError(VIR_ERR_INTERNAL_ERROR,
a41c76
                        _("backing store for %s (%s) is self-referential"),
a41c76
-                       src->path, uniqueName);
a41c76
+                       NULLSTR(src->path), uniqueName);
a41c76
         goto cleanup;
a41c76
     }
a41c76
 
a41c76
-- 
a41c76
2.25.1
a41c76