From a7cc18e5635ca4a1515167d331cd582e53471636 Mon Sep 17 00:00:00 2001 From: erw7 Date: Mon, 1 Apr 2019 19:29:12 +0900 Subject: fs.c: fix is_executable_ext - Fix the problem of checking the extension in a UNIX like shell. - Fix the problem of not checking the existence of the file when the pathext contains an extension. --- src/nvim/os/fs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 6ac53dd45b..388faddac1 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -331,10 +331,12 @@ static bool is_executable_ext(char *name, const char *pathext, char_u **abspath) const char *ext_end = xstrchrnul(ext, ENV_SEPCHAR); size_t ext_len = (size_t)(ext_end - ext); STRLCPY(buf_end, ext, ext_len + 1); - bool in_pathext = nameext_len == ext_len - && 0 == mb_strnicmp((char_u *)nameext, (char_u *)ext, ext_len); + bool in_pathext = (strstr((char *)path_tail(p_sh), "sh") != NULL) + || (nameext_len == ext_len + && 0 == mb_strnicmp((char_u *)nameext, (char_u *)ext, ext_len)); - if (in_pathext || is_executable(os_buf, abspath)) { + if ((in_pathext && is_executable(name, abspath)) + || is_executable(os_buf, abspath)) { return true; } -- cgit