summaryrefslogtreecommitdiff
path: root/toolchain/musl/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-21 11:03:20 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-10-21 11:03:20 +0000
commit4d5218e08362d2cc6bc11ca677ad631ae806957b (patch)
tree45b3db4b004400a29d0748b62f3b6869121ed178 /toolchain/musl/patches
parent4669d08e831af1f4a686fcf050fdb344f203c427 (diff)
downloadmtk-20170518-4d5218e08362d2cc6bc11ca677ad631ae806957b.zip
mtk-20170518-4d5218e08362d2cc6bc11ca677ad631ae806957b.tar.gz
mtk-20170518-4d5218e08362d2cc6bc11ca677ad631ae806957b.tar.bz2
musl: fix getopt optional argument processing
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43009
Diffstat (limited to 'toolchain/musl/patches')
-rw-r--r--toolchain/musl/patches/110-getopt_optional_argument_fix.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/toolchain/musl/patches/110-getopt_optional_argument_fix.patch b/toolchain/musl/patches/110-getopt_optional_argument_fix.patch
new file mode 100644
index 0000000..7deebdc
--- /dev/null
+++ b/toolchain/musl/patches/110-getopt_optional_argument_fix.patch
@@ -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;