mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fs.c: fix is_executable_ext()
- Corresponds to the case where pathext contains a zero-length extension. - Remove unnecessary break statements. - Fix function attributes.
This commit is contained in:
parent
a062d307fb
commit
70a0a12b53
@ -301,7 +301,7 @@ static bool is_executable(const char *name, char_u **abspath)
|
||||
/// - if the file extension is in $PATHEXT and `name` is executable
|
||||
/// - if the result of any $PATHEXT extension appended to `name` is executable
|
||||
static bool is_executable_ext(char *name, char_u **abspath)
|
||||
FUNC_ATTR_NONNULL_ARG(1, 2)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
const bool is_unix_shell = strstr((char *)path_tail(p_sh), "sh") != NULL;
|
||||
char *nameext = strrchr(name, '.');
|
||||
@ -325,6 +325,7 @@ static bool is_executable_ext(char *name, char_u **abspath)
|
||||
|
||||
const char *ext_end = xstrchrnul(ext, ENV_SEPCHAR);
|
||||
size_t ext_len = (size_t)(ext_end - ext);
|
||||
if (ext_len != 0) {
|
||||
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);
|
||||
@ -333,9 +334,6 @@ static bool is_executable_ext(char *name, char_u **abspath)
|
||||
|| is_executable(os_buf, abspath)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (*ext_end != ENV_SEPCHAR) {
|
||||
break;
|
||||
}
|
||||
ext = ext_end;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user