diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2016-02-28 12:44:59 +0100 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2016-04-20 08:25:51 +0200 |
commit | 88a735166b7ee1eadaf6d46be11804dc0e1a251a (patch) | |
tree | 2b39c525bb9120f6cc192106f0f93d7b4ca9016a /src | |
parent | 50a7517a6deb7d8eaa02bf718e273b7058066d89 (diff) | |
download | rneovim-88a735166b7ee1eadaf6d46be11804dc0e1a251a.tar.gz rneovim-88a735166b7ee1eadaf6d46be11804dc0e1a251a.tar.bz2 rneovim-88a735166b7ee1eadaf6d46be11804dc0e1a251a.zip |
vim-patch:7.4.1114
Problem: delete() does not work well with symbolic links.
Solution: Recognize symbolik links.
https://github.com/vim/vim/commit/43a34f9f74fdce462fa250baab620264c28b6165
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/fs.c | 17 | ||||
-rw-r--r-- | src/nvim/tempfile.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 34d8fde4f1..bc2d37764d 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -59,6 +59,23 @@ int os_dirname(char_u *buf, size_t len) return OK; } +/// Check if the given path is a directory and not a symlink to a directory. +/// @return `true` if `name` is a directory and NOT a symlink to a directory. +/// `false` if `name` is not a directory or if an error occurred. +bool os_isrealdir(const char_u *name) + FUNC_ATTR_NONNULL_ALL +{ + uv_fs_t request; + if (uv_fs_lstat(&fs_loop, &request, (char *)name, NULL) != kLibuvSuccess) { + return false; + } + if (S_ISLNK(request.statbuf.st_mode)) { + return false; + } else { + return S_ISDIR(request.statbuf.st_mode); + } +} + /// Check if the given path is a directory or not. /// /// @return `true` if `fname` is a directory. diff --git a/src/nvim/tempfile.c b/src/nvim/tempfile.c index 882dbe32f2..5b6268168d 100644 --- a/src/nvim/tempfile.c +++ b/src/nvim/tempfile.c @@ -63,7 +63,7 @@ int delete_recursive(char_u *name) { int result = 0; - if (os_isdir(name)) { + if (os_isrealdir(name)) { snprintf((char *)NameBuff, MAXPATHL, "%s/*", name); char_u **files; diff --git a/src/nvim/version.c b/src/nvim/version.c index 2828442611..235d74de76 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -250,7 +250,7 @@ static int included_patches[] = { // 1117, // 1116, // 1115 NA - // 1114, + 1114, 1113, 1112, // 1111, |