about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--posix/getopt.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ba702c0efd..48e5b036d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-04-07  Zack Weinberg  <zackw@panix.com>
 
+	* posix/getopt.c (_getopt_internal_r): Don't increment
+	d->optind a second time when reporting ambiguous -W options.
+
 	* posix/getopt_int.h: Include getopt.h.
 	Use impl-namespace names for all arguments to _getopt_internal and
 	_getopt_internal_r.
diff --git a/posix/getopt.c b/posix/getopt.c
index f1fa0166d8..e616aa6e4d 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -850,7 +850,6 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 #endif
 	      }
 	    d->__nextchar += strlen (d->__nextchar);
-	    d->optind++;
 	    return '?';
 	  }
 	if (pfound != NULL)