From 7757ce1cb82b690f056814fb0008eeee9f57684d Mon Sep 17 00:00:00 2001 From: erw7 Date: Sat, 9 Mar 2019 14:26:02 +0900 Subject: [PATCH] executable(): return false if user is not owner #9703 S_IXUSR does not check ownership. Test case: touch test.txt chmod 744 test.txt sudo chown root:root test.txt nvim -u NORC :echo executable('./test.txt') --- src/nvim/os/fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 7f2ebeec2f..27db675c52 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -288,7 +288,11 @@ static bool is_executable(const char *name) // a directory. return (S_ISREG(mode)); #else - return (S_ISREG(mode) && (S_IXUSR & mode)); + int r = -1; + if (S_ISREG(mode)) { + RUN_UV_FS_FUNC(r, uv_fs_access, name, X_OK, NULL); + } + return (r == 0); #endif }