about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-05-02 09:56:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-05-02 09:56:09 +0000
commit304d5f9b3974f33c566b8e57bc1b79a99e9955d9 (patch)
tree862c41500fccf27aefd3e1981be68012669c1b26 /Src
parent2c7f678ff0dce6c33bb3954ac3e0d025fc504a14 (diff)
downloadzsh-304d5f9b3974f33c566b8e57bc1b79a99e9955d9.tar.gz
zsh-304d5f9b3974f33c566b8e57bc1b79a99e9955d9.tar.xz
zsh-304d5f9b3974f33c566b8e57bc1b79a99e9955d9.zip
11057: getopts bug
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 79648561e..7e536756a 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3077,7 +3077,15 @@ err:
 	    p = ztrdup(args[zoptind++]);
 	} else
 	    p = metafy(str+optcind, lenstr-optcind, META_DUP);
-	optcind = ztrlen(args[zoptind - 1]);
+	/*
+	 * Careful:  I've just changed the following two lines from
+	 *   optcind = ztrlen(args[zoptind - 1]);
+	 * and it's a rigorous theorem that every change in getopts breaks
+	 * something.  See zsh-workers/9095 for the bug fixed here.
+	 *   PWS 2000/05/02
+	 */
+	optcind = 0;
+	zoptind++;
 	zsfree(zoptarg);
 	zoptarg = p;
     } else {