summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-13 01:04:21 -0500
committerRich Felker <dalias@aerifal.cx>2014-12-13 01:04:21 -0500
commit567cc81c7e3f38c3ca9b223f5d771205711b1f5c (patch)
treeb2268a3ed66e0dd932768d8d1ec2ec280aaa1734
parentb4ef1830b7863bfba1da4bdad56a20ef398672a8 (diff)
downloadmusl-567cc81c7e3f38c3ca9b223f5d771205711b1f5c.tar.gz
fix handling of "--" with getopt_long argv permutation
if argv permutation is used, the option terminator "--" should be moved before any skipped non-option arguments rather than being left in the argv tail where the caller will see and interpret it.
-rw-r--r--src/misc/getopt_long.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c
index c3cf7f93..c3593716 100644
--- a/src/misc/getopt_long.c
+++ b/src/misc/getopt_long.c
@@ -33,7 +33,6 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
if (i >= argc || !argv[i]) return -1;
if (argv[i][0] != '-') continue;
if (!argv[i][1]) continue;
- if (argv[i][1] == '-' && !argv[i][2]) return -1;
break;
}
optind = i;