about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2013-12-06 09:47:28 +0200
committerPeter Stephenson <pws@zsh.org>2013-12-06 09:28:42 +0000
commitb28a6365f6ea5a9fdb8b63dd1612f55eb4034990 (patch)
treed439bf26b3ba376c2fa8d43eebf20b86f7e60ee4 /Src/exec.c
parentc1a15fb1522b85a0780ce3f67ec1254115b18501 (diff)
downloadzsh-b28a6365f6ea5a9fdb8b63dd1612f55eb4034990.tar.gz
zsh-b28a6365f6ea5a9fdb8b63dd1612f55eb4034990.tar.xz
zsh-b28a6365f6ea5a9fdb8b63dd1612f55eb4034990.zip
32091: WARN_CREATE_GLOBAL false positive.
In cases like () { foo=bar =true; }
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index df915e152..dccdc2b0d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3309,7 +3309,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	    }
 	    if (type == WC_SIMPLE) {
 		if (varspc) {
-		    addvars(state, varspc, ADDVAR_EXPORT|ADDVAR_RESTRICT);
+		    int addflags = ADDVAR_EXPORT|ADDVAR_RESTRICT;
+		    if (forked)
+			addflags |= ADDVAR_RESTORE;
+		    addvars(state, varspc, addflags);
 		    if (errflag)
 			_exit(1);
 		}