]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: do not overwrite return value when filling qemuCapsCache
authorJán Tomko <jtomko@redhat.com>
Thu, 14 Apr 2016 11:48:57 +0000 (13:48 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 14 Apr 2016 14:37:50 +0000 (16:37 +0200)
In qemuHotplugCreateObjects, the ret variable was filled by
the value returned by qemuTestCapsCacheInsert.

If any of the functions after this assignment failed, we would still
return success.

Also adjust testCompareXMLToArgvHelper, where this change is just
cosmetic, because the value was overwritten right away.

tests/qemuhotplugtest.c
tests/qemuxml2argvtest.c

index 1eb2b6a881f25ceec0c8c6eb8240020f5f7c00c2..ea6dc361183a573860598558d9f09e2f69e4c3c9 100644 (file)
@@ -78,9 +78,8 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
     if (event)
         virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT);
 
-    ret = qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
-                                  priv->qemuCaps);
-    if (ret < 0)
+    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
+                                priv->qemuCaps) < 0)
         goto cleanup;
 
     if (!((*vm)->def = virDomainDefParseString(domxml,
index be7417820e44a0510f9dddbcbb199cab519b3585..39443e22d88c349e708b2681b8d75a23ae46006c 100644 (file)
@@ -407,9 +407,8 @@ testCompareXMLToArgvHelper(const void *data)
     if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
         flags |= FLAG_FIPS;
 
-    result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
-                                     info->extraFlags);
-    if (result < 0)
+    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
+                                info->extraFlags) < 0)
         goto cleanup;
 
     result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,