Blob Blame History Raw
From b501151fe2fb1f3b3e8d9617fb1b5a160832f480 Mon Sep 17 00:00:00 2001
Message-Id: <b501151fe2fb1f3b3e8d9617fb1b5a160832f480@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 28 Feb 2020 10:24:31 +0100
Subject: [PATCH] virStorageFileGetMetadataRecurse: Expect NULL src->path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 157b8722cbcc57103d3dd9211aa94a2c592849b6)

https://bugzilla.redhat.com/show_bug.cgi?id=1798148
Message-Id: <6f8aa7a68bbde2e405c83c53ee78e746d3efbf39.1582881363.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/virstoragefile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 911f811ace..28d1d1aa1e 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);
 
     /* 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);
         goto cleanup;
     }
 
-- 
2.25.1