about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/builtin.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7847ef33c..068779055 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-22  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 12040: Src/builtin.c: typeset -r on existing parameter set
+	the readonly flag before assigning any value on the same command
+	line.
+
 2000-06-22  Bart Schaefer  <schaefer@zsh.org>
 
 	* 12039: Test/comptest: Use "compinit -u" to avoid a possible
diff --git a/Src/builtin.c b/Src/builtin.c
index 8ea88862f..90c82c06e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1622,7 +1622,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 		    arrfixenv(pm->nam, x);
 	    }
 	}
-	pm->flags = (pm->flags | on) & ~(off | PM_UNSET);
+	pm->flags = (pm->flags | (on & ~PM_READONLY)) & ~(off | PM_UNSET);
 	/* This auxlen/pm->ct stuff is a nasty hack. */
 	if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER |
 		   PM_EFLOAT | PM_FFLOAT)) &&
@@ -1643,6 +1643,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	    zwarnnam(cname, "can't assign new value for array %s", pname, 0);
 	    return NULL;
 	}
+	pm->flags |= (on & PM_READONLY);
 	return pm;
     }