From 6ae0265fd590453fb2340f07e68620b47ee8e0db Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 21 Oct 2014 11:03:20 +0000 Subject: [PATCH] musl: fix getopt optional argument processing Signed-off-by: Felix Fietkau SVN-Revision: 43009 --- .../110-getopt_optional_argument_fix.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 toolchain/musl/patches/110-getopt_optional_argument_fix.patch 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; -- 2.30.2