[PATCH 2/4] interface: report correct interface count when not returning list

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

 



The spec for virConnectListAllInterfaces says that if the pointer that
is supposed to hold the list of interfaces is NULL, the function
should just return the count of interfaces that matched the filter,
but the code never increments the count if the list pointer is NULL.
---
 src/interface/interface_backend_netcf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 9f74541..a01fbd6 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -632,8 +632,9 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
             if (!(iface_obj = virGetInterface(conn, ncf_if_name(iface),
                                               ncf_if_mac_string(iface))))
                 goto cleanup;
-            tmp_iface_objs[niface_objs++] = iface_obj;
+            tmp_iface_objs[niface_objs] = iface_obj;
         }
+        niface_objs++;
 
         ncf_if_free(iface);
         iface = NULL;
-- 
2.4.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]