From 1b34b996888429358b71dc9e943a1c0ae98aa040 Mon Sep 17 00:00:00 2001
From: andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Date: Fri, 26 Apr 2002 23:40:09 +0000
Subject: Ensure that getenv("PATH") stays current, since otherwise cmdedit
 (which calls getenv("PATH")) would not operate upon the current PATH
 settings, which was really quite iritating.  -Erik

git-svn-id: svn://busybox.net/trunk/busybox@4677 69ca8d6d-28ef-0310-b511-8ec308f3f277
---
 shell/ash.c | 4 +++-
 shell/msh.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

(limited to 'shell')

diff --git a/shell/ash.c b/shell/ash.c
index e721c4ee5..99d5e7d74 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4111,6 +4111,8 @@ path_change(const char *newval, int *bltin)
 	}
 	if (builtinloc >= 0 && *bltin < 0)
 		firstchange = 0;
+	/* Ensure that getenv("PATH") stays current */
+	setenv("PATH", newval, 1);
 	return firstchange;
 }
 /*
@@ -12433,7 +12435,7 @@ findvar(struct var **vpp, const char *name)
 /*
  * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
  * This file contains code for the times builtin.
- * $Id: ash.c,v 1.48 2002/04/24 23:12:10 andersen Exp $
+ * $Id: ash.c,v 1.49 2002/04/26 23:39:48 andersen Exp $
  */
 static int timescmd (int argc, char **argv)
 {
diff --git a/shell/msh.c b/shell/msh.c
index a2f98c837..1485ccb6f 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -842,6 +842,8 @@ extern int msh_main(int argc, char **argv)
 #endif
 		}
 		onecommand();
+		/* Ensure that getenv("PATH") stays current */
+		setenv("PATH", path->value, 1);
 	}
 }
 
-- 
cgit v1.2.3-55-g6feb