For both virNodeDeviceObjNumOfDevices and virNodeDeviceObjGetNames, the
check should be if the aclfilter doesn't exist or if it does exist, then
it must pass
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/virnodedeviceobj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index 75ba1a0..4f47b4e 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -486,7 +486,7 @@ virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs,
for (i = 0; i < devs->count; i++) {
virNodeDeviceObjPtr obj = devs->objs[i];
virNodeDeviceObjLock(obj);
- if (aclfilter && aclfilter(conn, obj->def) &&
+ if ((!aclfilter || aclfilter(conn, obj->def)) &&
(!cap || virNodeDeviceObjHasCap(obj, cap)))
++ndevs;
virNodeDeviceObjUnlock(obj);
@@ -510,7 +510,7 @@ virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs,
for (i = 0; i < devs->count && nnames < maxnames; i++) {
virNodeDeviceObjPtr obj = devs->objs[i];
virNodeDeviceObjLock(obj);
- if (aclfilter && aclfilter(conn, obj->def) &&
+ if ((!aclfilter || aclfilter(conn, obj->def)) &&
(!cap || virNodeDeviceObjHasCap(obj, cap))) {
if (VIR_STRDUP(names[nnames], obj->def->name) < 0) {
virNodeDeviceObjUnlock(obj);
--
2.9.3