[PATCH 1/3] cpu.c: Check properly for virCapabilitiesGetNodeInfo() retval

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

 



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@xxxxxxxxxx>
---
 src/cpu/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index d9288cc85a..ae3a0acc10 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -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);
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux