aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-03-09 14:26:02 +0900
committerJustin M. Keyes <justinkz@gmail.com>2019-03-09 23:18:03 +0100
commit7757ce1cb82b690f056814fb0008eeee9f57684d (patch)
treedb38230032fad6832ffb83a97ef615b2295654f8
parent6eca56c6c5a994be77ad6fd28a3639d963cb7ffc (diff)
downloadrneovim-7757ce1cb82b690f056814fb0008eeee9f57684d.tar.gz
rneovim-7757ce1cb82b690f056814fb0008eeee9f57684d.tar.bz2
rneovim-7757ce1cb82b690f056814fb0008eeee9f57684d.zip
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')
-rw-r--r--src/nvim/os/fs.c6
1 files changed, 5 insertions, 1 deletions
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
}