mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
musl: fix getopt optional argument processing
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43009 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
9c2251891b
commit
a04caa9327
@ -0,0 +1,20 @@
|
||||
--- a/src/misc/getopt.c
|
||||
+++ b/src/misc/getopt.c
|
||||
@@ -55,7 +55,9 @@ int getopt(int argc, char * const argv[]
|
||||
return '?';
|
||||
}
|
||||
if (optstring[i+1] == ':') {
|
||||
+ if (optstring[i+2] == ':') optarg = 0;
|
||||
if (optind >= argc) {
|
||||
+ if (optstring[i+2] == ':') return c;
|
||||
if (optstring[0] == ':') return ':';
|
||||
if (opterr) {
|
||||
write(2, argv[0], strlen(argv[0]));
|
||||
@@ -65,7 +67,6 @@ int getopt(int argc, char * const argv[]
|
||||
}
|
||||
return '?';
|
||||
}
|
||||
- if (optstring[i+2] == ':') optarg = 0;
|
||||
if (optstring[i+2] != ':' || optpos) {
|
||||
optarg = argv[optind++] + optpos;
|
||||
optpos = 0;
|
||||
Loading…
x
Reference in New Issue
Block a user