aboutsummaryrefslogtreecommitdiffstats
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
commita04caa932789ee787f06bba08460a2c7cf4a55f8 (patch)
treea716677eb2e8364b9c67a048894bc21007c4613f
parent9c2251891b6bca9e45a71b46fb89cfb65ac38bfd (diff)
downloadupstream-a04caa932789ee787f06bba08460a2c7cf4a55f8.tar.gz
upstream-a04caa932789ee787f06bba08460a2c7cf4a55f8.tar.bz2
upstream-a04caa932789ee787f06bba08460a2c7cf4a55f8.zip
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
-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 0000000000..7deebdc251
--- /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;