aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-12-05 17:26:55 +0000
committerRon Yorston <rmy@pobox.com>2018-12-05 17:26:55 +0000
commitd257c7f2b6c44662c793d00d0b9286d6246b84a3 (patch)
treefd651c08a7f27053a18d30f1a40ba819643668ee
parent2a34d6d4e3122df2f84eb1290221128be47dc36b (diff)
downloadbusybox-w32-d257c7f2b6c44662c793d00d0b9286d6246b84a3.tar.gz
busybox-w32-d257c7f2b6c44662c793d00d0b9286d6246b84a3.tar.bz2
busybox-w32-d257c7f2b6c44662c793d00d0b9286d6246b84a3.zip
ash: fix 'type' and 'command -v'
The 'type' and 'command -v' builtins could return incorrect information when their argument included a file separator. For example: $ command -v cmd C:/Windows/system32/cmd.exe $ command -v C:/Windows/system32/cmd.exe $ echo $? 127 Fix the faulty logic causing this.
-rw-r--r--shell/ash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 510a86cab..cbe30a78b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13841,7 +13841,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
13841 entry->u.index = -1; 13841 entry->u.index = -1;
13842 if (act & DO_ABS) { 13842 if (act & DO_ABS) {
13843#if ENABLE_PLATFORM_MINGW32 13843#if ENABLE_PLATFORM_MINGW32
13844 while ((fullname=add_win32_extension(name)) == NULL || 13844 while ((fullname=add_win32_extension(name)) == NULL &&
13845 stat(name, &statb) < 0 ) { 13845 stat(name, &statb) < 0 ) {
13846#else 13846#else
13847 while (stat(name, &statb) < 0) { 13847 while (stat(name, &statb) < 0) {