svn commit: r342740 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Thu Jan 3 20:22:37 UTC 2019


Author: jilles
Date: Thu Jan  3 20:22:35 2019
New Revision: 342740
URL: https://svnweb.freebsd.org/changeset/base/342740

Log:
  sh: Do not place exported but unset variables into the environment
  
  PR:		233545
  Submitted by:	Jan Beich
  Obtained from:	NetBSD

Modified:
  head/bin/sh/var.c

Modified: head/bin/sh/var.c
==============================================================================
--- head/bin/sh/var.c	Thu Jan  3 19:35:07 2019	(r342739)
+++ head/bin/sh/var.c	Thu Jan  3 20:22:35 2019	(r342740)
@@ -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;


More information about the svn-src-head mailing list