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

[virt-tools-list] [libosinfo 2/4] loader: Set GError on osinfo_loader_nodeset failures



Most of the code in OsinfoLoader check if osinfo_loader_nodeset
set a GError to see if it failed and never test if it returned -1.
Better to make sure that we actually set the GError when this
function fails.
---
 osinfo/osinfo_loader.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 1c27187..606e413 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -133,6 +133,8 @@ osinfo_loader_nodeset(const char *xpath,
     if (obj == NULL)
         return(0);
     if (obj->type != XPATH_NODESET) {
+        g_set_error(err, g_quark_from_static_string("libosinfo"), 0,
+                    _("Expected a nodeset in XPath query %s"), xpath);
         xmlXPathFreeObject(obj);
         return (-1);
     }
-- 
1.8.0.1


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