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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to