diff options
author | Ján Tomko <jtomko@redhat.com> | 2016-04-14 13:48:57 +0200 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2016-04-14 16:37:50 +0200 |
commit | d0cc8b10c39e4d9cb93ac69ee1271485514c3557 (patch) | |
tree | b2266700a55275e5d20daef56ecbb9d55a4f7c29 /tests | |
parent | 0d81f2318b22d5b73fde4cbc4ecbdbb3dc02c60c (diff) | |
download | libvirt-d0cc8b10c39e4d9cb93ac69ee1271485514c3557.tar.gz |
tests: do not overwrite return value when filling qemuCapsCache
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qemuhotplugtest.c | 5 | ||||
-rw-r--r-- | tests/qemuxml2argvtest.c | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 1eb2b6a881..ea6dc36118 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -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, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index be7417820e..39443e22d8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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, |