[PATCH 2/8] tests: don't overwrite error in storage xml-to-argv test

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

 



When cmd is NULL, virCommandToString reports an OOM error,
overwriting the error reported by virStorageBackendCreateQemuImgCmd.
---
 tests/storagevolxml2argvtest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index e1507b4..46b77b2 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -61,14 +61,14 @@ testCompareXMLToArgvFiles(bool shouldFail,
     cmd = virStorageBackendCreateQemuImgCmd(conn, &poolobj, vol, inputvol,
                                             flags, create_tool, imgformat);
 
-    actualCmdline = virCommandToString(cmd);
-    if (!actualCmdline) {
+    if (!cmd) {
         if (shouldFail) {
             virResetLastError();
             ret = 0;
         }
         goto cleanup;
     }
+    actualCmdline = virCommandToString(cmd);
 
     len = virtTestLoadFile(cmdline, &expectedCmdline);
     if (len < 0)
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]