about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/params.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cbf6e5ea..cd38639e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-03  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 28384: Src/params.c: improve error message on assignment to a
+	field of a read-only hash.
+
 2010-10-27  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Doc/Zsh/grammar.yo: typo pointed out by
@@ -13794,5 +13799,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5116 $
+* $Revision: 1.5117 $
 *****************************************************
diff --git a/Src/params.c b/Src/params.c
index f49a07f1a..7ac33b912 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2591,8 +2591,15 @@ assignsparam(char *s, char *val, int flags)
 	*ss = '\0';
 	if (!(v = getvalue(&vbuf, &s, 1)))
 	    createparam(t, PM_ARRAY);
-	else
+	else {
+	    if (v->pm->node.flags & PM_READONLY) {
+		zerr("read-only variable: %s", v->pm->node.nam);
+		*ss = '[';
+		zsfree(val);
+		return NULL;
+	    }
 	    flags &= ~ASSPM_WARN_CREATE;
+	}
 	*ss = '[';
 	v = NULL;
     } else {