about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-01-10 10:27:01 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-01-10 10:32:31 -0800
commitdaa788d88b7935ac93a9be54691bdd56e68ae2f3 (patch)
treec37995135e0946f0c002ffa39cf1328d22f162e7 /Src/builtin.c
parent199581f7803795a521be0d37c462fd7c3a6506a1 (diff)
downloadzsh-daa788d88b7935ac93a9be54691bdd56e68ae2f3.tar.gz
zsh-daa788d88b7935ac93a9be54691bdd56e68ae2f3.tar.xz
zsh-daa788d88b7935ac93a9be54691bdd56e68ae2f3.zip
34212: do not change unset-ness of special parameters when exporting them
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 8abe728db..8dee8f910 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1935,7 +1935,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
      * even if that's unset
      */
     if (pm && (pm->node.flags & PM_SPECIAL))
-	usepm = 1;
+	usepm = 2;	/* indicate that we preserve the PM_UNSET flag */
 
     /*
      * Don't use an existing param if
@@ -2072,7 +2072,11 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 		    arrfixenv(pm->node.nam, x);
 	    }
 	}
-	pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~(off | PM_UNSET);
+	if (usepm == 2)		/* do not change the PM_UNSET flag */
+	    pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~off;
+	else
+	    pm->node.flags = (pm->node.flags |
+			      (on & ~PM_READONLY)) & ~(off | PM_UNSET);
 	if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
 	    if (typeset_setwidth(cname, pm, ops, on, 0))
 		return NULL;