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

Re: [virt-tools-list] [PATCH 2/2] osinfo-detect: ignore DB loading errors



On Tue, Sep 04, 2012 at 05:07:14PM +0200, Christophe Fergeau wrote:
> 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);

ACK, i guess this is reasonable.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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