From: Bjoern Walk Date: Tue, 3 May 2016 06:10:53 +0000 (+0200) Subject: tools: virt-host-validate: improve error handling X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=efc23df2513a6ec93d1b77bac2eeb8b2681f243e;p=libvirt.git 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 --- diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c index eb08e7edda..47f2f98877 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",