summaryrefslogtreecommitdiffstats
path: root/bin/sh/main.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-12-24 15:14:22 +0000
committerjilles <jilles@FreeBSD.org>2009-12-24 15:14:22 +0000
commit979a1ef888d4a268658576bcd3793a3a47bb707d (patch)
treeac09eb24e922c647beec91bfabcc7667760f0fae /bin/sh/main.c
parentab355c0d662d8fd56d0d6d17844eb0e1620d0f30 (diff)
downloadFreeBSD-src-979a1ef888d4a268658576bcd3793a3a47bb707d.zip
FreeBSD-src-979a1ef888d4a268658576bcd3793a3a47bb707d.tar.gz
sh: Remove setting variables from dotcmd/exportcmd.
It is already done by evalcommand(), unless special-ness has been removed, in which case variable assignments should not persist. (These are currently always special builtins, but this will change later: command builtin, command substitution.) This also fixes a memory leak when calling . with variable assignments. Example: valgrind --leak-check=full sh -c 'x=1 . /dev/null; x=2'
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r--bin/sh/main.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index f26e611..b27d0cf 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -315,7 +315,6 @@ find_dot_file(char *basename)
int
dotcmd(int argc, char **argv)
{
- struct strlist *sp;
char *fullname;
if (argc < 2)
@@ -323,9 +322,6 @@ dotcmd(int argc, char **argv)
exitstatus = 0;
- for (sp = cmdenviron; sp ; sp = sp->next)
- setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
-
fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
OpenPOWER on IntegriCloud