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