render / rpms / libvirt

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