From 6f0259a4fc7d827db027fe122377687ef780e17c Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 13 Apr 2011 14:52:23 -0400 Subject: [PATCH] fix bug whereby getopt_long allowed mismatch in last char of option name --- src/linux/getopt_long.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux/getopt_long.c b/src/linux/getopt_long.c index d80cd1b6..6d3a4a6e 100644 --- a/src/linux/getopt_long.c +++ b/src/linux/getopt_long.c @@ -14,7 +14,7 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con const char *name = longopts[i].name; char *opt = argv[optind]+1; if (*opt == '-') opt++; - while (*name && *name++ == *opt++); + for (; *name && *name == *opt; name++, opt++); if (*name || (*opt && *opt != '=')) continue; if (*opt == '=') { if (!longopts[i].has_arg) continue; -- 2.25.1