[Libosinfo] [PATCH] Fix error propagation in DB loader

Christophe Fergeau cfergeau at redhat.com
Fri Apr 28 06:58:54 UTC 2017


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Thu, Apr 27, 2017 at 06:03:36PM +0100, Daniel P. Berrange wrote:
> When failing to read the pci/usb ID files we failed to
> propagate the reported error.
> 
> We also had some dead code which would never be reached
> due to earlier gotos.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  osinfo/osinfo_loader.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index 6c7c009..dca23f1 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -2127,9 +2127,6 @@ static void osinfo_loader_process_list(OsinfoLoader *loader,
>          tmp++;
>      }
>  
> -    if (lerr)
> -        goto cleanup;
> -
>      /* Phase 2: load data from non-native locations, filtering based
>       * on overrides from native locations */
>      tmp = dirs;
> @@ -2151,15 +2148,13 @@ static void osinfo_loader_process_list(OsinfoLoader *loader,
>          }
>  
>          if (lerr) {
> -            break;
> +            g_propagate_error(err, lerr);
> +            goto cleanup;
>          }
>  
>          tmp++;
>      }
>  
> -    if (lerr)
> -        goto cleanup;
> -
>      /* Phase 3: load combined set of files from native locations */
>      g_hash_table_iter_init(&iter, allentries);
>      while (g_hash_table_iter_next(&iter, &key, &value)) {
> -- 
> 2.9.3
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20170428/169db72a/attachment.sig>


More information about the Libosinfo mailing list