From: Rich Felker Date: Thu, 20 Oct 2016 16:13:33 +0000 (-0400) Subject: fix getopt_long_only misinterpreting "--" as an option X-Git-Tag: v1.1.16~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b24f1d2520c87077cef21e085893e5f3c565a6df;p=oweals%2Fmusl.git fix getopt_long_only misinterpreting "--" as an option --- diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c index 480c0013..c6e14625 100644 --- a/src/misc/getopt_long.c +++ b/src/misc/getopt_long.c @@ -53,7 +53,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring { optarg = 0; if (longopts && argv[optind][0] == '-' && - ((longonly && argv[optind][1]) || + ((longonly && argv[optind][1] && argv[optind][1] != '-') || (argv[optind][1] == '-' && argv[optind][2]))) { int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':';