aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch')
-rw-r--r--main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch b/main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch
new file mode 100644
index 0000000000..b0b0ac1360
--- /dev/null
+++ b/main/musl/0021-fix-getopt-handling-of-initial-in-optstring.patch
@@ -0,0 +1,29 @@
+From d4f7d9c46f0e8f19d70871efb66b0f482935642d Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 10 Dec 2014 21:29:01 -0500
+Subject: [PATCH] fix getopt handling of initial '+' in optstring
+
+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 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/misc/getopt.c b/src/misc/getopt.c
+index 52aa7a3..e77e460 100644
+--- 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;
+--
+2.2.0
+