aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-05-09 15:33:00 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-05-09 15:33:00 -0400
commit1a3ee71de258b416ca6b80f0a9e3b91460df8dc7 (patch)
treea59167e50add55b51ed31c65944cfa78ddd1c290 /src/main.c
parentf3dda65de157f2d7c35286018c20cbc7597ed748 (diff)
parenteae498c4c5d34c1d0af40ecb430cbbc23b0a8e97 (diff)
downloadrneovim-1a3ee71de258b416ca6b80f0a9e3b91460df8dc7.tar.gz
rneovim-1a3ee71de258b416ca6b80f0a9e3b91460df8dc7.tar.bz2
rneovim-1a3ee71de258b416ca6b80f0a9e3b91460df8dc7.zip
Merge pull request #619 from stefan991/mch_stat-cleanup
Replace `struct stat` with `FileInfo`
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