render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d76c62
From e0c86b78dc5587263aeb10ae0fc8fbb5975135ee Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <e0c86b78dc5587263aeb10ae0fc8fbb5975135ee@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Fri, 28 Feb 2020 10:24:30 +0100
d76c62
Subject: [PATCH] virStorageFileGetMetadataRecurse: Shuffle around assignment
d76c62
 of backing chain depth
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Move the assignment to a place where we know that the backing store is
d76c62
present rather than having to check in the cleanup section.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Eric Blake <eblake@redhat.com>
d76c62
(cherry picked from commit b347e5c7dd69e3381b073c640ece2460632830cc)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
d76c62
Message-Id: <0432e2bd0f224cd1c55104e33699cb1602013a5d.1582881363.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/util/virstoragefile.c | 9 ++++-----
d76c62
 1 file changed, 4 insertions(+), 5 deletions(-)
d76c62
d76c62
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
d76c62
index 1f18320756..911f811ace 100644
d76c62
--- a/src/util/virstoragefile.c
d76c62
+++ b/src/util/virstoragefile.c
d76c62
@@ -5053,14 +5053,15 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
d76c62
             ret = 0;
d76c62
             goto cleanup;
d76c62
         }
d76c62
+
d76c62
+        backingStore->id = depth;
d76c62
+        src->backingStore = g_steal_pointer(&backingStore);
d76c62
     } else {
d76c62
         /* add terminator */
d76c62
-        if (!(backingStore = virStorageSourceNew()))
d76c62
+        if (!(src->backingStore = virStorageSourceNew()))
d76c62
             goto cleanup;
d76c62
     }
d76c62
 
d76c62
-    src->backingStore = g_steal_pointer(&backingStore);
d76c62
-
d76c62
     if (src->externalDataStoreRaw) {
d76c62
         g_autoptr(virStorageSource) externalDataStore = NULL;
d76c62
 
d76c62
@@ -5080,8 +5081,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
d76c62
     ret = 0;
d76c62
 
d76c62
  cleanup:
d76c62
-    if (virStorageSourceHasBacking(src))
d76c62
-        src->backingStore->id = depth;
d76c62
     virStorageFileDeinit(src);
d76c62
     return ret;
d76c62
 }
d76c62
-- 
d76c62
2.25.1
d76c62