summaryrefslogtreecommitdiffstats
path: root/src/filepath.c
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2024-06-18 20:43:51 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-18 20:43:51 +0200
commit23c5ebeb95cb942df307946e3ced230a7c8312eb (patch)
treeba0d773ef75a8b7a58b77cb9cb675fce1d28827c /src/filepath.c
parenta821b609f9bb9daef032fe1cb8fb95995822e367 (diff)
patch 9.1.0499: MS-Windows: doesn't handle symlinks properlyv9.1.0499
Problem: MS-Windows: doesn't handle symlinks properly (Timothy Madden) Solution: Implement lstat() on MS-Windows (author) lstat() differs from stat() in how it handles symbolic links, the former doesn't resolve the symlink while the latter does so. Implement a simple yet effective fallback using Win32 APIs. fixes #14933 closes: #15014 Co-authored-by: K.Takata <kentkt@csc.jp> Signed-off-by: LemonBoy <thatlemon@gmail.com> Signed-off-by: K.Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/filepath.c')
-rw-r--r--src/filepath.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/filepath.c b/src/filepath.c
index 9f68d7c688..788d3bbe5b 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -3645,11 +3645,15 @@ dos_expandpath(
}
else
{
+ stat_T sb;
+
// no more wildcards, check if there is a match
// remove backslashes for the remaining components only
if (*path_end != 0)
backslash_halve(buf + len + 1);
- if (mch_getperm(buf) >= 0) // add existing file
+ // add existing file
+ if ((flags & EW_ALLLINKS) ? mch_lstat((char *)buf, &sb) >= 0
+ : mch_getperm(buf) >= 0)
addfile(gap, buf, flags);
}
}