[libosinfo] Don't fail when there's an error loading the user DB

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

 



osinfo_loader_process_default_path() currently returns an error if
there was a problem when parsing the user database. This leads
application to error out when an invalid XML file is dropped in
~/.config/libosinfo/db/
As the stricter behaviour can be achieved using public libosinfo API,
we can change osinfo_loader_process_default_path() to be less strict
and more useful to applications.
---
 osinfo/osinfo_loader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 467af3f..bc17a2e 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1892,8 +1892,10 @@ void osinfo_loader_process_default_path(OsinfoLoader *loader, GError **err)
         goto error;
 
     osinfo_loader_process_user_path(loader, &error);
-    if (error)
-        goto error;
+    if (error) {
+        g_warning("Error loading libosinfo user data: %s", error->message);
+        g_clear_error(&error);
+    }
 
     return;
 
-- 
1.8.1.4

_______________________________________________
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