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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/posix/getopt.c b/posix/getopt.c
index 2ad4ee961c..a6d2d042c7 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -673,7 +673,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 		pfound = p;
 		indfound = option_index;
 	      }
-	    else if (pfound->has_arg != p->has_arg
+	    else if (long_only
+		     || pfound->has_arg != p->has_arg
 		     || pfound->flag != p->flag
 		     || pfound->val != p->val)
 	      /* Second or later nonexact match found.  */