From: Jincheng Miao Date: Fri, 28 Mar 2014 23:13:01 +0000 (+0800) Subject: Fix virNodeDeviceListCaps always returns empty X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=15a173fc13b4a16707a0d88b17a8a631791a4083;p=libvirt.git Fix virNodeDeviceListCaps always returns empty 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 Signed-off-by: Ján Tomko --- diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 1f3a0835a2..6906463b81 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -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;