[PATCH 19/24] virstoragetest: testPrepImages: Don't reuse 'cmd' pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virstoragetest.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 955ac64e0b..90dde512cf 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -86,7 +86,8 @@ static int
 testPrepImages(void)
 {
     int ret = EXIT_FAILURE;
-    g_autoptr(virCommand) cmd = NULL;
+    g_autoptr(virCommand) cmdqcow2 = NULL;
+    g_autoptr(virCommand) cmdwrap = NULL;
     g_autofree char *buf = NULL;
     g_autofree char *absraw = g_strdup_printf("%s/raw", datadir);
     g_autofree char *absqcow2 = g_strdup_printf("%s/qcow2", datadir);
@@ -118,25 +119,24 @@ testPrepImages(void)

     /* Create a qcow2 wrapping relative raw; later on, we modify its
      * metadata to test other configurations */
-    cmd = virCommandNewArgList(qemuimg, "create",
-                               "-f", "qcow2",
-                               "-F", "raw",
-                               "-b", absraw,
-                               "-o", "compat=0.10",
-                               absqcow2, NULL);
-    if (virCommandRun(cmd, NULL) < 0)
+    cmdqcow2 = virCommandNewArgList(qemuimg, "create",
+                                    "-f", "qcow2",
+                                    "-F", "raw",
+                                    "-b", absraw,
+                                    "-o", "compat=0.10",
+                                    absqcow2, NULL);
+    if (virCommandRun(cmdqcow2, NULL) < 0)
         goto skip;

     /* Create a second qcow2 wrapping the first, to be sure that we
      * can correctly avoid insecure probing.  */
-    virCommandFree(cmd);
-    cmd = virCommandNewArgList(qemuimg, "create",
-                               "-f", "qcow2",
-                               "-F", "qcow2",
-                               "-b", absqcow2,
-                               "-o", "compat=1.1",
-                               abswrap, NULL);
-    if (virCommandRun(cmd, NULL) < 0)
+    cmdwrap = virCommandNewArgList(qemuimg, "create",
+                                   "-f", "qcow2",
+                                   "-F", "qcow2",
+                                   "-b", absqcow2,
+                                   "-o", "compat=1.1",
+                                   abswrap, NULL);
+    if (virCommandRun(cmdwrap, NULL) < 0)
         goto skip;

     ret = 0;
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux