[PATCH 2/2] osinfo-detect: ignore DB loading errors

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

 



osinfo-detect is currently exiting with a failure when a DB loading
error occurs. However, such errors should not be fatal as they can
happen when the user put a malformed XML file in
~/.local/share/libosinfo. The worse that can happen when this function
fails is that the OsinfoDB will not be populated, but this shouldn't
cause memory corruption or crashes, so we can log the error and go on.
---
 tools/osinfo-detect.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c
index 683833f..c21ec5c 100644
--- a/tools/osinfo-detect.c
+++ b/tools/osinfo-detect.c
@@ -208,9 +208,12 @@ gint main(gint argc, gchar **argv)
     osinfo_loader_process_default_path(loader, &error);
     if (error != NULL) {
         g_printerr("Error loading OS data: %s\n", error->message);
-
-        ret = -4;
-        goto EXIT;
+        /* errors loading the osinfo database are not fatal as this can
+         * happen when the user has an invalid file in
+         * ~/.local/share/libosinfo for example. Let's report but ignore
+         * them
+         */
+        g_clear_error(&error);
     }
 
     db = osinfo_loader_get_db(loader);
-- 
1.7.11.4


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux