]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix virNodeDeviceListCaps always returns empty
authorJincheng Miao <jmiao@redhat.com>
Fri, 28 Mar 2014 23:13:01 +0000 (07:13 +0800)
committerJán Tomko <jtomko@redhat.com>
Sat, 29 Mar 2014 05:51:10 +0000 (06:51 +0100)
virNodeDeviceListCaps will always return empty for a pci nodedevice,
actually it should return 'pci'.

It is because the loop variable ncaps isn't increased.

Introduced by commit be2636f.

https://bugzilla.redhat.com/show_bug.cgi?id=1081932

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/node_device/node_device_driver.c

index 1f3a0835a298dfe22f7beaf123a6eb32aa8bcc6d..6906463b8194d7c72decef8fdc29576e233828f1 100644 (file)
@@ -420,7 +420,7 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
         goto cleanup;
 
     for (caps = obj->def->caps; caps && ncaps < maxnames; caps = caps->next) {
-        if (VIR_STRDUP(names[ncaps], virNodeDevCapTypeToString(caps->type)) < 0)
+        if (VIR_STRDUP(names[ncaps++], virNodeDevCapTypeToString(caps->type)) < 0)
             goto cleanup;
     }
     ret = ncaps;