about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-01 18:32:28 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-01 18:32:28 +0000
commit976d44ae1a521a78f08e0dc21aa1dd291a83859a (patch)
tree0b7a3f5ed2d4dd03b32b058c1df6978100bec13f /Src
parent03dcc784a6a601200c03fbef995e7316d1fb4ca4 (diff)
downloadzsh-976d44ae1a521a78f08e0dc21aa1dd291a83859a.tar.gz
zsh-976d44ae1a521a78f08e0dc21aa1dd291a83859a.tar.xz
zsh-976d44ae1a521a78f08e0dc21aa1dd291a83859a.zip
manual/8121
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 7a6ed15e4..ed77497d3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1692,19 +1692,23 @@ execcmd(Cmd cmd, int input, int output, int how, int last1)
 	if (!hn) {
 	    /* Resolve external commands */
 	    char *cmdarg = (char *) peekfirst(args);
+	    char **checkpath = pathchecked;
 	    int dohashcmd = isset(HASHCMDS);
 
 	    hn = cmdnamtab->getnode(cmdnamtab, cmdarg);
 	    if (hn && trycd && !isreallycom((Cmdnam)hn)) {
+		if (!(((Cmdnam)hn)->flags & HASHED)) {
+		    checkpath = path;
+		    dohashcmd = 1;
+		}
 		cmdnamtab->removenode(cmdnamtab, cmdarg);
 		cmdnamtab->freenode(hn);
 		hn = NULL;
-		dohashcmd = 1;
 	    }
 	    if (!hn && dohashcmd && strcmp(cmdarg, "..")) {
 		for (s = cmdarg; *s && *s != '/'; s++);
 		if (!*s)
-		    hn = (HashNode) hashcmd(cmdarg, pathchecked);
+		    hn = (HashNode) hashcmd(cmdarg, checkpath);
 	    }
 	}