aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-04-26 18:23:49 +0200
committerStefan Hoffmann <stefan991@gmail.com>2014-05-09 15:49:33 +0200
commit902ad8d94d9a1eafde858793587037e620c6ee6f (patch)
treee2dd0405439b1e2a703a3949729d12215dc7e032 /src/main.c
parenta080819c3ef93c41a0bbd14b3c5f76d26bb9d404 (diff)
downloadrneovim-902ad8d94d9a1eafde858793587037e620c6ee6f.tar.gz
rneovim-902ad8d94d9a1eafde858793587037e620c6ee6f.tar.bz2
rneovim-902ad8d94d9a1eafde858793587037e620c6ee6f.zip
replaced some mch_stat() with os_get_file_info()
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 9fd97b23a5..828a6d5200 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2130,14 +2130,13 @@ process_env (
*/
static int file_owned(char *fname)
{
- struct stat s;
uid_t uid = getuid();
-
- return !(mch_stat(fname, &s) != 0 || s.st_uid != uid
-# ifdef HAVE_LSTAT
- || mch_lstat(fname, &s) != 0 || s.st_uid != uid
-# endif
- );
+ FileInfo file_info;
+ bool file_owned = os_get_file_info(fname, &file_info)
+ && file_info.stat.st_uid == uid;
+ bool link_owned = os_get_file_info_link(fname, &file_info)
+ && file_info.stat.st_uid == uid;
+ return file_owned && link_owned;
}
#endif