render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 20f764d1837f06b10c7c327b085234b6e5f876e2 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <20f764d1837f06b10c7c327b085234b6e5f876e2@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Fri, 28 Feb 2020 10:24:32 +0100
fbe740
Subject: [PATCH] virStorageFileGetMetadataRecurse: Use virHashHasEntry instead
fbe740
 of fake pointers
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Replacing virHashLookup by virHashHasEntry allows us to use NULL as the
fbe740
payload of the hash table rather than putting a fake '1' pointer into
fbe740
the table.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Eric Blake <eblake@redhat.com>
fbe740
(cherry picked from commit e3960f4b6d0b6d8cb8b2631f8358abf289c1cc18)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
fbe740
Message-Id: <af53b5ff04169cfa8e40664f2b66f110560486ee.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 28d1d1aa1e..46d55eda96 100644
fbe740
--- a/src/util/virstoragefile.c
fbe740
+++ b/src/util/virstoragefile.c
fbe740
@@ -4992,14 +4992,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
     if (!(uniqueName = virStorageFileGetUniqueIdentifier(src)))
fbe740
         goto cleanup;
fbe740
 
fbe740
-    if (virHashLookup(cycle, uniqueName)) {
fbe740
+    if (virHashHasEntry(cycle, uniqueName)) {
fbe740
         virReportError(VIR_ERR_INTERNAL_ERROR,
fbe740
                        _("backing store for %s (%s) is self-referential"),
fbe740
                        NULLSTR(src->path), uniqueName);
fbe740
         goto cleanup;
fbe740
     }
fbe740
 
fbe740
-    if (virHashAddEntry(cycle, uniqueName, (void *)1) < 0)
fbe740
+    if (virHashAddEntry(cycle, uniqueName, NULL) < 0)
fbe740
         goto cleanup;
fbe740
 
fbe740
     if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER,
fbe740
-- 
fbe740
2.25.1
fbe740