summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-10 21:29:01 -0500
committerRich Felker <dalias@aerifal.cx>2014-12-10 21:29:01 -0500
commitd4f7d9c46f0e8f19d70871efb66b0f482935642d (patch)
tree40ece515db8eacc3c4877f49f95bd1df49c0ea86 /src
parentcfd7b4acd55420deedd41e0614c9b614c73c743e (diff)
downloadmusl-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.c2
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;