diff options
-rw-r--r-- | Src/exec.c | 8 |
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); } } |