diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 5 |
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); } |