diff options
author | Peter Stephenson <pws@zsh.org> | 2015-04-29 15:54:49 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-04-29 15:54:49 +0100 |
commit | bf258a1c07a9cf1119f83d1d15310b02b94f4d67 (patch) | |
tree | af7f12d596efe96213fd12ed3328e9342fc59107 /Src/params.c | |
parent | c96a993d51e3e5958c8161d0dbe86cb43bcc52c1 (diff) | |
download | zsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.tar.gz zsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.tar.xz zsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.zip |
34992: POSIX fix for readonly variables.
With POSIXBUILTINS, variables can be marked readonly if unset. Also, variables can't have the readonly flag removed.
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/params.c b/Src/params.c index e8a90104c..d53b6ca7e 100644 --- a/Src/params.c +++ b/Src/params.c @@ -874,10 +874,14 @@ createparam(char *name, int flags) DPUTS(oldpm && oldpm->level > locallevel, "BUG: old local parameter not deleted"); if (oldpm && (oldpm->level == locallevel || !(flags & PM_LOCAL))) { + if (isset(POSIXBUILTINS) && (oldpm->node.flags & PM_READONLY)) { + zerr("read-only variable: %s", name); + return NULL; + } if (!(oldpm->node.flags & PM_UNSET) || (oldpm->node.flags & PM_SPECIAL)) { oldpm->node.flags &= ~PM_UNSET; if ((oldpm->node.flags & PM_SPECIAL) && oldpm->ename) { - Param altpm = + Param altpm = (Param) paramtab->getnode(paramtab, oldpm->ename); if (altpm) altpm->node.flags &= ~PM_UNSET; |