about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-03-04 21:36:45 -0800
committerBart Schaefer <schaefer@zsh.org>2024-03-04 21:36:45 -0800
commitd27ea2ae02275b255f9efbf929d1dc7932aebc57 (patch)
treebb9ea78b977ee50661be30b9cb99b05522d7234b /Src
parent83e9dd15c1d76fc5199b98572b271d471fc98dff (diff)
downloadzsh-d27ea2ae02275b255f9efbf929d1dc7932aebc57.tar.gz
zsh-d27ea2ae02275b255f9efbf929d1dc7932aebc57.tar.xz
zsh-d27ea2ae02275b255f9efbf929d1dc7932aebc57.zip
unposted (cf. 52617): only scalars can instantiate a declared named reference
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Src/params.c b/Src/params.c
index 263cd0c52..4bcf41c22 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1050,8 +1050,14 @@ createparam(char *name, int flags)
 			name = refname;
 			oldpm = NULL;
 		    } else {
-			if (!(lastpm->node.flags & PM_READONLY))
-			    lastpm->node.flags |= PM_UNSET;
+			if (!(lastpm->node.flags & PM_READONLY)) {
+			    if (flags) {
+				/* Only plain scalar assignment allowed */
+				zerr("%s: can't change type of named reference",
+				     name);	/* Differs from ksh93u+ */
+				return NULL;
+			    }
+			}
 			return lastpm;
 		    }
 		} else {