]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
interface: report correct interface count when not returning list
authorLaine Stump <laine@laine.org>
Fri, 18 Sep 2015 17:24:47 +0000 (13:24 -0400)
committerLaine Stump <laine@laine.org>
Fri, 2 Oct 2015 15:16:11 +0000 (11:16 -0400)
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

index 9f745411e8592c27bdd325699807875ec373095b..a01fbd6fe8715d79087982257bc3dba33ed2ae0d 100644 (file)
@@ -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;