[libosinfo PATCH 1/3] loader: properly load the treeinfo attributes

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

 



treeinfo attributes haven't been loaded properly due to the change done
in ab2ab35f, changing the hardcoded 9 to sizeof("treeinfo-").

The problem here is that size("treeinfo-") is 10, causing that any
comparison to fail.

Let's change the sizeof("treeinfo-") to strlen("treeinfo-").

Signed-off-by: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx>
---
 osinfo/osinfo_loader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 030062b..b6b6bd2 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1222,22 +1222,22 @@ static OsinfoTree *osinfo_loader_tree(OsinfoLoader *loader,
             continue;
 
         if (g_str_equal((const gchar *)nodes[i]->name,
-                        OSINFO_TREE_PROP_TREEINFO_FAMILY + sizeof("treeinfo-")))
+                        OSINFO_TREE_PROP_TREEINFO_FAMILY + strlen("treeinfo-")))
             osinfo_entity_set_param(OSINFO_ENTITY(tree),
                                     OSINFO_TREE_PROP_TREEINFO_FAMILY,
                                     (const gchar *)nodes[i]->children->content);
         else if (g_str_equal((const gchar *)nodes[i]->name,
-                             OSINFO_TREE_PROP_TREEINFO_VARIANT + sizeof("treeinfo-")))
+                             OSINFO_TREE_PROP_TREEINFO_VARIANT + strlen("treeinfo-")))
             osinfo_entity_set_param(OSINFO_ENTITY(tree),
                                     OSINFO_TREE_PROP_TREEINFO_VARIANT,
                                     (const gchar *)nodes[i]->children->content);
         else if (g_str_equal((const gchar *)nodes[i]->name,
-                             OSINFO_TREE_PROP_TREEINFO_VERSION + sizeof("treeinfo-")))
+                             OSINFO_TREE_PROP_TREEINFO_VERSION + strlen("treeinfo-")))
             osinfo_entity_set_param(OSINFO_ENTITY(tree),
                                     OSINFO_TREE_PROP_TREEINFO_VERSION,
                                     (const gchar *)nodes[i]->children->content);
         else if (g_str_equal((const gchar *)nodes[i]->name,
-                             OSINFO_TREE_PROP_TREEINFO_ARCH + sizeof("treeinfo-")))
+                             OSINFO_TREE_PROP_TREEINFO_ARCH + strlen("treeinfo-")))
             osinfo_entity_set_param(OSINFO_ENTITY(tree),
                                     OSINFO_TREE_PROP_TREEINFO_ARCH,
                                     (const gchar *)nodes[i]->children->content);
-- 
1.8.3.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux