Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jan 2019 20:22:36 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342740 - head/bin/sh
Message-ID:  <201901032022.x03KMaTq073798@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901032022.x03KMaTq073798>