projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfd7b4a
)
fix getopt handling of initial '+' in optstring
author
Rich Felker
<dalias@aerifal.cx>
Thu, 11 Dec 2014 02:29:01 +0000
(21:29 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 11 Dec 2014 02:29:01 +0000
(21:29 -0500)
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
patch
|
blob
|
history
diff --git
a/src/misc/getopt.c
b/src/misc/getopt.c
index 52aa7a3a6a664e74869eea34d4939d5f3deefa43..e77e460a0edc1cdffe197caf760b2738f5bc5f74 100644
(file)
--- 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;