From f1617441dbb36094eb8acaedcd120a2e4e5c6e9d Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Wed, 23 Sep 2015 13:22:18 +0200 Subject: [PATCH] xbps-query: fail on trailing parameters. --- NEWS | 2 ++ bin/xbps-query/main.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8e358868..747111d6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ xbps-0.48 (???): + * xbps-query(1): fail if unused arguments are supplied. + * libxbps: relative cachedir set via xbps.d(5) now work correctly. Fixes #117 (https://github.com/voidlinux/xbps/issues/117) diff --git a/bin/xbps-query/main.c b/bin/xbps-query/main.c index 803b0521..3a28fa17 100644 --- a/bin/xbps-query/main.c +++ b/bin/xbps-query/main.c @@ -221,7 +221,12 @@ main(int argc, char **argv) } else if (!opmode) { /* show mode by default */ show = opmode = true; - pkg = *argv; + pkg = *(argv++); + argc--; + } + if (argc) { + /* trailing parameters */ + usage(true); } /* * Initialize libxbps.