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

[libvirt] [PATCH 3/4] tools: virt-host-validate: improve error handling



When virHostValidateCPUFlag returns NULL, that's more an unexpected
error than the sign of missing CPU flags. Let's react to this
appropriately.

Signed-off-by: Bjoern Walk <bwalk linux vnet ibm com>
---
 tools/virt-host-validate-qemu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index eb08e7e..47f2f98 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -33,10 +33,10 @@ int virHostValidateQEMU(void)
 
     virHostMsgCheck("QEMU", "%s", _("for hardware virtualization"));
 
-    flags = virHostValidateGetCPUFlags();
+    if (!(flags = virHostValidateGetCPUFlags()))
+        return -1;
 
-    if (flags &&
-        (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) ||
+    if ((virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) ||
          virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))) {
         virHostMsgPass();
         if (virHostValidateDeviceExists("QEMU", "/dev/kvm",
-- 
2.6.6


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