mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-10 08:42:02 +03:00
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:
parent
cfd7b4acd5
commit
d4f7d9c46f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user