PR 21418, ar -N lacks arg check

PR 21418
	* ar.c (main): Check -a, -b, -i and -N args are given.
This commit is contained in:
Alan Modra 2017-04-23 17:39:48 +09:30
parent 7034215fd6
commit 42354845ae
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-04-23 Alan Modra <amodra@gmail.com>
PR 21418
* ar.c (main): Check -a, -b, -i and -N args are given.
2017-04-23 Alan Modra <amodra@gmail.com>
PR 21417

View File

@ -776,12 +776,18 @@ main (int argc, char **argv)
default_deterministic ();
if (postype != pos_default)
posname = argv[arg_index++];
{
posname = argv[arg_index++];
if (posname == NULL)
fatal (_("missing position arg."));
}
if (counted_name_mode)
{
if (operation != extract && operation != del)
fatal (_("`N' is only meaningful with the `x' and `d' options."));
if (argv[arg_index] == NULL)
fatal (_("`N' missing value."));
counted_name_counter = atoi (argv[arg_index++]);
if (counted_name_counter <= 0)
fatal (_("Value for `N' must be positive."));