sh: Do not place exported but unset variables into the environment

PR:		233545
Submitted by:	Jan Beich
Obtained from:	NetBSD
This commit is contained in:
Jilles Tjoelker 2019-01-03 20:22:35 +00:00
parent d3f4030708
commit 56f33d07ce

View File

@ -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;