From efc23df2513a6ec93d1b77bac2eeb8b2681f243e Mon Sep 17 00:00:00 2001 From: Bjoern Walk Date: Tue, 3 May 2016 08:10:53 +0200 Subject: [PATCH] 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 --- 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 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",