diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-12-10 21:29:01 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-12-10 21:29:01 -0500 |
commit | d4f7d9c46f0e8f19d70871efb66b0f482935642d (patch) | |
tree | 40ece515db8eacc3c4877f49f95bd1df49c0ea86 /src | |
parent | cfd7b4acd55420deedd41e0614c9b614c73c743e (diff) | |
download | musl-d4f7d9c46f0e8f19d70871efb66b0f482935642d.tar.gz |
fix getopt handling of initial '+' in optstring
in the case where an initial '+' was passed in optstring (a
getopt_long feature to suppress argv permutation), getopt would fail
to see a possible subsequent ':', resulting in incorrect handling of
missing arguments.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc/getopt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc/getopt.c b/src/misc/getopt.c index 52aa7a3a..e77e460a 100644 --- a/src/misc/getopt.c +++ b/src/misc/getopt.c @@ -55,7 +55,7 @@ int getopt(int argc, char * const argv[], const char *optstring) optpos = 0; } - if (optstring[0] == '-') + if (optstring[0] == '-' || optstring[0] == '+') optstring++; i = 0; |