render / rpms / libvirt

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