From 852a80acf72e4c96489249a2958546b2155b3f2b Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 5 Feb 2011 14:01:46 +0000 Subject: sh: Forget all cached command locations on any PATH change. POSIX requires this and it is simpler than the previous code that remembered command locations when appending directories to PATH. In particular, PATH=$PATH is no longer a no-op but discards all cached command locations. --- bin/sh/exec.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'bin') diff --git a/bin/sh/exec.c b/bin/sh/exec.c index 6297e9b..67eafff 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -494,30 +494,7 @@ hashcd(void) void changepath(const char *newval) { - const char *old, *new; - int idx; - int firstchange; - - old = pathval(); - new = newval; - firstchange = 9999; /* assume no change */ - idx = 0; - for (;;) { - if (*old != *new) { - firstchange = idx; - if ((*old == '\0' && *new == ':') - || (*old == ':' && *new == '\0')) - firstchange++; - old = new; /* ignore subsequent differences */ - } - if (*new == '\0') - break; - if (*new == ':') { - idx++; - } - new++, old++; - } - clearcmdentry(firstchange); + clearcmdentry(0); } -- cgit v1.1