musl: backport various post-1.1.15 fixes
[openwrt/openwrt.git] / toolchain / musl / patches / 052-fix-getopt_long_only-misinterpreting-as-an-option.patch
1 From b24f1d2520c87077cef21e085893e5f3c565a6df Mon Sep 17 00:00:00 2001
2 From: Rich Felker <dalias@aerifal.cx>
3 Date: Thu, 20 Oct 2016 12:13:33 -0400
4 Subject: fix getopt_long_only misinterpreting "--" as an option
5
6 ---
7 src/misc/getopt_long.c | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10 diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c
11 index 480c001..c6e1462 100644
12 --- a/src/misc/getopt_long.c
13 +++ b/src/misc/getopt_long.c
14 @@ -53,7 +53,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring
15 {
16 optarg = 0;
17 if (longopts && argv[optind][0] == '-' &&
18 - ((longonly && argv[optind][1]) ||
19 + ((longonly && argv[optind][1] && argv[optind][1] != '-') ||
20 (argv[optind][1] == '-' && argv[optind][2])))
21 {
22 int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':';
23 --
24 cgit v0.11.2