about summary refs log tree commit diff
path: root/posix/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/getopt.c')
-rw-r--r--posix/getopt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/posix/getopt.c b/posix/getopt.c
index f1add57292..2ad4ee961c 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -673,7 +673,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 		pfound = p;
 		indfound = option_index;
 	      }
-	    else
+	    else if (pfound->has_arg != p->has_arg
+		     || pfound->flag != p->flag
+		     || pfound->val != p->val)
 	      /* Second or later nonexact match found.  */
 	      ambig = 1;
 	  }