summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-06-05 09:45:45 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-06-05 09:45:45 -0700
commit11d2dbda38c1b3cafdb3f91a02134b2807a15c27 (patch)
treeb74831a23372312fedd65dfe5d52e681fdb7aa81 /Src
parenta6135f6114697c7755590b26062668d18f267d2b (diff)
downloadzsh-11d2dbda38c1b3cafdb3f91a02134b2807a15c27.tar.gz
zsh-11d2dbda38c1b3cafdb3f91a02134b2807a15c27.tar.xz
zsh-11d2dbda38c1b3cafdb3f91a02134b2807a15c27.zip
41225: sethparam() should not attempt to change special parameters into hashes
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/Src/params.c b/Src/params.c
index d92dd228a..6fbee880c 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3242,12 +3242,17 @@ sethparam(char *s, char **val)
     if (!(v = fetchvalue(&vbuf, &s, 1, SCANPM_ASSIGNING))) {
 	createparam(t, PM_HASHED);
 	checkcreate = 1;
-    } else if (!(PM_TYPE(v->pm->node.flags) & PM_HASHED) &&
-	     !(v->pm->node.flags & PM_SPECIAL)) {
-	unsetparam(t);
-	/* no WARNCREATEGLOBAL check here as parameter already existed */
-	createparam(t, PM_HASHED);
-	v = NULL;
+    } else if (!(PM_TYPE(v->pm->node.flags) & PM_HASHED)) {
+	if (!(v->pm->node.flags & PM_SPECIAL)) {
+	    unsetparam(t);
+	    /* no WARNCREATEGLOBAL check here as parameter already existed */
+	    createparam(t, PM_HASHED);
+	    v = NULL;
+	} else {
+	    zerr("%s: can't change type of a special parameter", t);
+	    unqueue_signals();
+	    return NULL;
+	}
     }
     if (!v)
 	if (!(v = fetchvalue(&vbuf, &t, 1, SCANPM_ASSIGNING))) {