소스 검색

Upstream update

Peter S. Mazinger 20 년 전
부모
커밋
2fb90be2fc
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      libc/unistd/getopt_long-susv3.c

+ 2 - 2
libc/unistd/getopt_long-susv3.c

@@ -17,11 +17,11 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
 		(argv[optind][1] == '-' && argv[optind][2]))
 	{
 		int i;
-		char *opt = argv[optind]+2;
 		for (i=0; longopts[i].name; i++) {
 			const char *name = longopts[i].name;
+			char *opt = argv[optind]+2;
 			while (*name && *name++ == *opt++);
-			if (*name && *opt != '=') continue;
+			if (*name || (*opt && *opt != '=')) continue;
 			if (*opt == '=') {
 				if (!longopts[i].has_arg) continue;
 				optarg = opt+1;