aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2019-01-03 20:22:35 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2019-01-03 20:22:35 +0000
commit56f33d07ce1976b1565f6680b83eaa9e1bcea9e5 (patch)
treee8ea6593768e3ecfbe98f8f75e5f155f62105185 /bin
parentd3f4030708faaaaaa7062bf3394b158375df687e (diff)
downloadsrc-56f33d07ce1976b1565f6680b83eaa9e1bcea9e5.tar.gz
src-56f33d07ce1976b1565f6680b83eaa9e1bcea9e5.zip
sh: Do not place exported but unset variables into the environment
PR: 233545 Submitted by: Jan Beich Obtained from: NetBSD
Notes
Notes: svn path=/head/; revision=342740
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/var.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 42f9556aad7b..0758289151ba 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -558,13 +558,13 @@ environment(void)
nenv = 0;
for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
for (vp = *vpp ; vp ; vp = vp->next)
- if (vp->flags & VEXPORT)
+ if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT)
nenv++;
}
ep = env = stalloc((nenv + 1) * sizeof *env);
for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
for (vp = *vpp ; vp ; vp = vp->next)
- if (vp->flags & VEXPORT)
+ if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT)
*ep++ = vp->text;
}
*ep = NULL;