summaryrefslogtreecommitdiffstats
path: root/bin/sh/var.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r--bin/sh/var.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 54a0a84..afb3c86 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -289,6 +289,7 @@ void
setvareq(char *s, int flags)
{
struct var *vp, **vpp;
+ char *p;
int len;
if (aflag)
@@ -319,7 +320,10 @@ setvareq(char *s, int flags)
if (vp == &vmpath || (vp == &vmail && ! mpathset()))
chkmail(1);
if ((vp->flags & VEXPORT) && localevar(s)) {
- putenv(s);
+ p = strchr(s, '=');
+ *p = '\0';
+ (void) setenv(s, p + 1, 1);
+ *p = '=';
(void) setlocale(LC_ALL, "");
}
INTON;
@@ -335,7 +339,10 @@ setvareq(char *s, int flags)
INTOFF;
*vpp = vp;
if ((vp->flags & VEXPORT) && localevar(s)) {
- putenv(s);
+ p = strchr(s, '=');
+ *p = '\0';
+ (void) setenv(s, p + 1, 1);
+ *p = '=';
(void) setlocale(LC_ALL, "");
}
INTON;
@@ -596,7 +603,10 @@ exportcmd(int argc, char **argv)
vp->flags |= flag;
if ((vp->flags & VEXPORT) && localevar(vp->text)) {
- putenv(vp->text);
+ p = strchr(vp->text, '=');
+ *p = '\0';
+ (void) setenv(vp->text, p + 1, 1);
+ *p = '=';
(void) setlocale(LC_ALL, "");
}
goto found;
OpenPOWER on IntegriCloud