summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-01-15 15:53:39 +0000
committerPeter Stephenson <pws@zsh.org>2016-01-15 15:53:39 +0000
commit0194b4ab1d0fc6aeae5416edb0122146da9646c9 (patch)
tree13fb01e93c223a3197ea8d46eba00c8d007d1e95
parent1d8b5285226afba4f1ef9030cf862c14b975c284 (diff)
downloadzsh-0194b4ab1d0fc6aeae5416edb0122146da9646c9.tar.gz
zsh-0194b4ab1d0fc6aeae5416edb0122146da9646c9.tar.xz
zsh-0194b4ab1d0fc6aeae5416edb0122146da9646c9.zip
37646: Return non-zero status from typeset assigning readonly
-rw-r--r--ChangeLog3
-rw-r--r--Src/builtin.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ffa7eec2..1c2b37420 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-01-15  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 37646: Src/builtin.c, Test/B02typeset.ztst: typeset should
+	return non-zero status on attempt to set readonly variable.
+
 	* 37643: Src/Zle/complist.c: Reset interrupt after getkeycmd()
 	in menu selection.
 
diff --git a/Src/builtin.c b/Src/builtin.c
index e1a799009..dd20f9eab 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2213,6 +2213,8 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 				 mkarray(NULL), 0)))
 		return NULL;
 	}
+	if (errflag)
+	    return NULL;
 	pm->node.flags |= (on & PM_READONLY);
 	if (OPT_ISSET(ops,'p'))
 	    paramtab->printnode(&pm->node, PRINT_TYPESET);