diff options
author | Nick Clifton <nickc@redhat.com> | 2019-07-24 12:17:37 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-07-24 12:17:37 +0100 |
commit | 2f86d5594071a16665711ae13da88af1cc904371 (patch) | |
tree | e1de9c2949c1da2936581eb7d729c79a14e1f4db /binutils | |
parent | cc364be6ff45669150077387f22723de33d5f1b1 (diff) | |
download | gdb-2f86d5594071a16665711ae13da88af1cc904371.zip gdb-2f86d5594071a16665711ae13da88af1cc904371.tar.gz gdb-2f86d5594071a16665711ae13da88af1cc904371.tar.bz2 |
Fix ar so that it can correctly detect non-dash prefixed options that appear after dash prefixed options.
PR 13256
* ar.c (decode_options): Restart option scanning if no operation
is detected and argument remain to be scanned.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/ar.c | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index cc8bb80..4d6d6e2 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2019-07-24 Nick Clifton <nickc@redhat.com> + + PR 13256 + * ar.c (decode_options): Restart option scanning if no operation + is detected and argument remain to be scanned. + 2019-07-23 Nick Clifton <nickc@redhat.com> PR 24818 diff --git a/binutils/ar.c b/binutils/ar.c index a65dd62..4e953c0 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -432,9 +432,10 @@ decode_options (int argc, char **argv) { int c; - /* Convert old-style tar call by exploding option element and rearranging + /* Convert old-style ar call by exploding option element and rearranging options accordingly. */ + restart: if (argc > 1 && argv[1][0] != '-') { int new_argc; /* argc value for rearranged arguments */ @@ -598,6 +599,17 @@ decode_options (int argc, char **argv) } } + /* PR 13256: Allow for the possibility that the first command line option + started with a dash (eg --plugin) but then the following option(s) are + old style, non-dash-prefixed versions. */ + if (operation == none && optind > 0 && optind < argc) + { + argv += (optind - 1); + argc -= (optind - 1); + optind = 0; + goto restart; + } + return &argv[optind]; } |