diff options
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/getopt32.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index b5efa19ac..4c05dcb97 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
| @@ -530,6 +530,7 @@ vgetopt32(char **argv, const char *applet_opts, const char *applet_long_options, | |||
| 530 | * "fake" short options, like this one: | 530 | * "fake" short options, like this one: |
| 531 | * wget $'-\203' "Test: test" http://kernel.org/ | 531 | * wget $'-\203' "Test: test" http://kernel.org/ |
| 532 | * (supposed to act as --header, but doesn't) */ | 532 | * (supposed to act as --header, but doesn't) */ |
| 533 | next_opt: | ||
| 533 | #if ENABLE_LONG_OPTS | 534 | #if ENABLE_LONG_OPTS |
| 534 | while ((c = getopt_long(argc, argv, applet_opts, | 535 | while ((c = getopt_long(argc, argv, applet_opts, |
| 535 | long_options, NULL)) != -1) { | 536 | long_options, NULL)) != -1) { |
| @@ -544,8 +545,16 @@ vgetopt32(char **argv, const char *applet_opts, const char *applet_long_options, | |||
| 544 | * but we construct long opts so that flag | 545 | * but we construct long opts so that flag |
| 545 | * is always NULL (see above) */ | 546 | * is always NULL (see above) */ |
| 546 | if (on_off->opt_char == '\0' /* && c != '\0' */) { | 547 | if (on_off->opt_char == '\0' /* && c != '\0' */) { |
| 547 | /* c is probably '?' - "bad option" */ | 548 | /* We reached the end of complementary[] and did not find -c */ |
| 548 | goto error; | 549 | if (c == '?') /* getopt says: "bad option, or option has no required argument" */ |
| 550 | goto error; | ||
| 551 | /* if there were options beyond 32 bits (example: ls), | ||
| 552 | * they got no complementary[] slot, and no result bit. | ||
| 553 | * IOW: they must be "accept but ignore" options. | ||
| 554 | * For them, we end up here. | ||
| 555 | */ | ||
| 556 | //bb_error_msg("ignored option '%c', skipping", c); | ||
| 557 | goto next_opt; | ||
| 549 | } | 558 | } |
| 550 | } | 559 | } |
| 551 | if (flags & on_off->incongruously) | 560 | if (flags & on_off->incongruously) |
