[libvirt-python PATCH] override: iterate virDomainFSInfo.devAliases using ndevAliases

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

 



Currently devAliases in virDomainFSInfo struct are iterated as a
NULL-terminated list, but that is not guaranteed. It should use
ndevAliases which stores the number of the items in devAliases.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@xxxxxxx>
---
 libvirt-override.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index 7ef66b7..e51c44d 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8334,8 +8334,8 @@ libvirt_virDomainGetFSInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
     PyObject *pyobj_domain;
     unsigned int flags;
     virDomainFSInfoPtr *fsinfo = NULL;
-    char **dev;
     int c_retval, i;
+    size_t j;
     PyObject *py_retval = NULL;
 
     if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainFSInfo",
@@ -8373,8 +8373,9 @@ libvirt_virDomainGetFSInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
         PyTuple_SetItem(info, 2, libvirt_constcharPtrWrap(fs->fstype));
         PyTuple_SetItem(info, 3, alias);
 
-        for (dev = fs->devAlias; dev && *dev; dev++)
-            if (PyList_Append(alias, libvirt_constcharPtrWrap(*dev)) < 0)
+        for (j = 0; j < fs->ndevAlias; j++)
+            if (PyList_Append(alias,
+                              libvirt_constcharPtrWrap(fs->devAlias[j])) < 0)
                 goto cleanup;
     }
 

--
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]