diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-06-28 03:24:35 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-06-28 03:24:35 -0400 |
commit | 2fcc07892fcf05479fa1142e6a4fe5101c1cdf7a (patch) | |
tree | 836e10a3a766d7e3bd4a6b8178b7f3a39264165b /src/nvim/os_unix.c | |
parent | 8a85b37253ccb3aa9e127a53f5a0c0ee80cd65d7 (diff) | |
parent | 147ab48d1ce6204ef80d4bdf0d44cfdf6863e690 (diff) | |
download | rneovim-2fcc07892fcf05479fa1142e6a4fe5101c1cdf7a.tar.gz rneovim-2fcc07892fcf05479fa1142e6a4fe5101c1cdf7a.tar.bz2 rneovim-2fcc07892fcf05479fa1142e6a4fe5101c1cdf7a.zip |
Merge #775 'Implement `FileID` struct'
Diffstat (limited to 'src/nvim/os_unix.c')
-rw-r--r-- | src/nvim/os_unix.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 946eaa62a2..6d1b06dbcf 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -381,12 +381,12 @@ char_u *name, int len /* buffer size, only used when name gets longer */ ) { - struct stat st; char_u *slash, *tail; DIR *dirp; struct dirent *dp; - if (lstat((char *)name, &st) >= 0) { + FileInfo file_info; + if (os_get_file_info_link((char *)name, &file_info)) { /* Open the directory where the file is located. */ slash = vim_strrchr(name, '/'); if (slash == NULL) { @@ -406,15 +406,14 @@ int len /* buffer size, only used when name gets longer */ if (STRICMP(tail, dp->d_name) == 0 && STRLEN(tail) == STRLEN(dp->d_name)) { char_u newname[MAXPATHL + 1]; - struct stat st2; /* Verify the inode is equal. */ STRLCPY(newname, name, MAXPATHL + 1); STRLCPY(newname + (tail - name), dp->d_name, MAXPATHL - (tail - name) + 1); - if (lstat((char *)newname, &st2) >= 0 - && st.st_ino == st2.st_ino - && st.st_dev == st2.st_dev) { + FileInfo file_info_new; + if (os_get_file_info_link((char *)newname, &file_info_new) + && os_file_info_id_equal(&file_info, &file_info_new)) { STRCPY(tail, dp->d_name); break; } |