From d257c7f2b6c44662c793d00d0b9286d6246b84a3 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 5 Dec 2018 17:26:55 +0000 Subject: 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. --- shell/ash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) entry->u.index = -1; if (act & DO_ABS) { #if ENABLE_PLATFORM_MINGW32 - while ((fullname=add_win32_extension(name)) == NULL || + while ((fullname=add_win32_extension(name)) == NULL && stat(name, &statb) < 0 ) { #else while (stat(name, &statb) < 0) { -- cgit v1.2.3-55-g6feb