about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index ce3aec0a2..1345b3006 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1924,10 +1924,13 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	    Param apm;
 	    char **x;
 	    if (PM_TYPE(pm->flags) == PM_ARRAY) {
-		x = zarrdup((*pm->gsu.a->getfn)(pm));
+		x = (*pm->gsu.a->getfn)(pm);
 		uniqarray(x);
-		pm->gsu.a->setfn(pm, x);
-		if (pm->ename && x)
+		if (pm->flags & PM_SPECIAL) {
+		    if (zheapptr(x))
+			x = zarrdup(x);
+		    (*pm->gsu.a->setfn)(pm, x);
+		} else if (pm->ename && x)
 		    arrfixenv(pm->ename, x);
 	    } else if (PM_TYPE(pm->flags) == PM_SCALAR && pm->ename &&
 		       (apm =