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.
This commit is contained in:
1 parent
cfd7b4acd5
commit
d4f7d9c46f
1 file changed
+1
-1
+1
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user