Author: nbd
Date: 2014-10-21 13:03:20 +0200 (Tue, 21 Oct 2014)
New Revision: 43009

Added:
   trunk/toolchain/musl/patches/110-getopt_optional_argument_fix.patch
Log:
musl: fix getopt optional argument processing

Signed-off-by: Felix Fietkau <[email protected]>

Added: trunk/toolchain/musl/patches/110-getopt_optional_argument_fix.patch
===================================================================
--- trunk/toolchain/musl/patches/110-getopt_optional_argument_fix.patch         
                (rev 0)
+++ trunk/toolchain/musl/patches/110-getopt_optional_argument_fix.patch 
2014-10-21 11:03:20 UTC (rev 43009)
@@ -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;
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to