[Libosinfo] [PATCH osinfo-db-tools 1/7] import: Fix argc check in main()
Christophe Fergeau
cfergeau at redhat.com
Fri Sep 21 10:12:40 UTC 2018
On Fri, Sep 21, 2018 at 11:13:42AM +0200, Fabiano Fidêncio wrote:
> osinfo-db-import takes at least one argument, the path to one archive
> file to import, and should just finish in case it's not passed.
It seems passing no argument, or passing '-' allows to pass the data on
stdin, checking for < 2 would prevent that.
Christophe
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
> tools/osinfo-db-import.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
> index f90bef9..320abc9 100644
> --- a/tools/osinfo-db-import.c
> +++ b/tools/osinfo-db-import.c
> @@ -241,7 +241,7 @@ gint main(gint argc, gchar **argv)
> goto error;
> }
>
> - if (argc > 2) {
> + if (argc < 2) {
> g_printerr(_("%s: expected path to one archive file to import\n"),
> argv0);
> goto error;
> --
> 2.17.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/20180921/2c85eee6/attachment.sig>
More information about the Libosinfo
mailing list