* mkgroup.c (main): Keep correctly track of optional arguments.

* mkpasswd.c (main): Ditto.
This commit is contained in:
Corinna Vinschen 2008-08-18 08:52:49 +00:00
parent 01dd3162ff
commit 096df1774b
3 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-08-18 Corinna Vinschen <corinna@vinschen.de>
* mkgroup.c (main): Keep correctly track of optional arguments.
* mkpasswd.c (main): Ditto.
2008-08-18 Corinna Vinschen <corinna@vinschen.de>
* mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.

View File

@ -786,7 +786,7 @@ main (int argc, char **argv)
domlist[print_domlist].domain = (c == 'd' || c == 'D');
opt = optarg ?:
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
if (opt == argv[optind])
if (argv[optind] && opt == argv[optind])
++optional_args;
for (i = 0; i < print_domlist; ++i)
if (domlist[i].domain == domlist[print_domlist].domain

View File

@ -758,7 +758,7 @@ main (int argc, char **argv)
domlist[print_domlist].domain = (c == 'd' || c == 'D');
opt = optarg ?:
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
if (opt == argv[optind])
if (argv[optind] && opt == argv[optind])
++optional_args;
for (i = 0; i < print_domlist; ++i)
if (domlist[i].domain == domlist[print_domlist].domain