[PATCH] pactree: Improve command line validation
Daniel M. Capella
polyzen at archlinux.org
Fri Mar 6 23:37:08 UTC 2020
On March 5, 2020 9:10:37 PM EST, Sebastian Jakubiak <jakseb.dev at gmail.com> wrote:
> Exit with non-zero status when the command line specifies more
> than one package or an unknown option.
>
> Fixes FS#64589.
>
> Signed-off-by: Sebastian Jakubiak <jakseb.dev at gmail.com>
> ---
>
> If I may, I would like to use this occasion to suggest a feature: the
> ability to process multiple packages by pactree. I am sending a patch
> for that in reply to this email.
>
> src/pactree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/pactree.c b/src/pactree.c
> index 5bc0032..9f074fe 100644
> --- a/src/pactree.c
> +++ b/src/pactree.c
> @@ -346,7 +346,6 @@ static int parse_options(int argc, char *argv[])
> version();
> cleanup(0);
> case 'h':
> - case '?':
> usage();
> cleanup(0);
> default:
> @@ -355,7 +354,8 @@ static int parse_options(int argc, char *argv[])
> }
> }
>
> - if(!argv[optind]) {
> + if(!argv[optind] || argv[optind + 1]) {
> + usage();
> return 1;
> }
>
Pushed, thank you.
--
Best,
Daniel <https://danielcapella.com>
More information about the pacman-contrib
mailing list