[PATCH 06/11] qemu: qapi: Return correct entry in virQEMUQapiSchemaTraverse

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

 



virQEMUQapiSchemaTraverse would return previous-to-last queried item on
a query. It would not be a problem if checking if the given path exists
since error reporting works properly but if the caller is interrested in
the result, it would be wrong.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_qapi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_qapi.c b/src/qemu/qemu_qapi.c
index e63896397f..c821e2eb55 100644
--- a/src/qemu/qemu_qapi.c
+++ b/src/qemu/qemu_qapi.c
@@ -76,7 +76,7 @@ virQEMUQapiSchemaTraverse(const char *baseName,
     virJSONValuePtr base;
     const char *metatype;

-    do {
+    while (1) {
         if (!(base = virHashLookup(schema, baseName)))
             return NULL;

@@ -114,7 +114,7 @@ virQEMUQapiSchemaTraverse(const char *baseName,
         }

         query++;
-    } while (*query);
+    }

     return base;
 }
-- 
2.16.2

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