소스 검색

fix bug whereby getopt_long allowed mismatch in last char of option name

Rich Felker 14 년 전
부모
커밋
6f0259a4fc
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/linux/getopt_long.c

+ 1 - 1
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;