]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: virt-host-validate: improve error handling
authorBjoern Walk <bwalk@linux.vnet.ibm.com>
Tue, 3 May 2016 06:10:53 +0000 (08:10 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 4 May 2016 14:30:30 +0000 (16:30 +0200)
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

index eb08e7edda1c9a540be8695c7dcbe3a5ff02c9ea..47f2f988775eb7d675c40aa7a09b0fde7715a74f 100644 (file)
@@ -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",