[PATCH 2/2] nodedev: Fix aclfilter check

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

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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