cpu.c: Check properly for virCapabilitiesGetNodeInfo() retval

The virCapabilitiesGetNodeInfo() function has the usual return
value semantics for integeres: a negative value means an error,
zero or a positive value means success. However, the function
call done in virCPUProbeHost() doesn't check for the return value
accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2020-01-24 10:22:13 +01:00
parent 29d43bf96a
commit 609acf1f5d

View File

@ -456,7 +456,7 @@ virCPUProbeHost(virArch arch)
{
virNodeInfo nodeinfo;
if (virCapabilitiesGetNodeInfo(&nodeinfo))
if (virCapabilitiesGetNodeInfo(&nodeinfo) < 0)
return NULL;
return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL);