summary refs log tree commit diff
diff options
context:
space:
mode:
-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;
 	  }