From d4f7d9c46f0e8f19d70871efb66b0f482935642d Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 10 Dec 2014 21:29:01 -0500 Subject: [PATCH] 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. --- src/misc/getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.25.1