basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-04-11 03:58:30 +02:00
parent 6161cdbb83
commit c13ee8c0f3
2 changed files with 7 additions and 0 deletions

View File

@ -51,6 +51,11 @@ int basename_main(int argc, char **argv)
size_t m, n;
char *s;
if (argv[1] && strcmp(argv[1], "--") == 0) {
argv++;
argc--;
}
if ((unsigned)(argc-2) >= 2) {
bb_show_usage();
}

View File

@ -10,6 +10,8 @@
char* FAST_FUNC single_argv(char **argv)
{
if (argv[1] && strcmp(argv[1], "--") == 0)
argv++;
if (!argv[1] || argv[2])
bb_show_usage();
return argv[1];