[Libosinfo] [libosinfo PATCH 3/3] db: improve _guess_os_from_tree checks

Christophe Fergeau cfergeau at redhat.com
Mon Dec 10 12:57:40 UTC 2018


Hey,

On Sun, Dec 02, 2018 at 04:37:59PM +0100, Fabiano Fidêncio wrote:
> Do not check against a distro that has all the treeinfo attribute as
> NULL as match_regex() would just match whatever we compare to it.

When can this happen?

Christophe

> 
> Signed-off-by: Fabiano Fidêncio <fabiano at fidencio.org>
> ---
>  osinfo/osinfo_db.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
> index fa14c6d..3bdc4c8 100644
> --- a/osinfo/osinfo_db.c
> +++ b/osinfo/osinfo_db.c
> @@ -763,6 +763,9 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
>              const gchar *os_version = osinfo_tree_get_treeinfo_version(os_tree);
>              const gchar *os_arch = osinfo_tree_get_treeinfo_arch(os_tree);
>  
> +            if (os_family == NULL && os_variant == NULL && os_version == NULL && os_arch == NULL)
> +                continue;
> +
>              if (match_regex(os_family, tree_family) &&
>                  match_regex(os_variant, tree_variant) &&
>                  match_regex(os_version, tree_version) &&
> -- 
> 1.8.3.1
> 
> _______________________________________________
> 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: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20181210/057778c6/attachment.sig>


More information about the Libosinfo mailing list