aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/path.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-07 07:13:13 +0800
committerGitHub <noreply@github.com>2022-02-07 07:13:13 +0800
commitcf86adba61d7ae93f129823eb65a0dcaf3df70c5 (patch)
tree56a429f22215a8cca22dbca44b35135d508a8b30 /src/nvim/path.c
parent380bc4fe22e8dbd478e58d568e0d749df439fec9 (diff)
parent72816136a57adbd051c688ee3213fa9446ea48f6 (diff)
downloadrneovim-cf86adba61d7ae93f129823eb65a0dcaf3df70c5.tar.gz
rneovim-cf86adba61d7ae93f129823eb65a0dcaf3df70c5.tar.bz2
rneovim-cf86adba61d7ae93f129823eb65a0dcaf3df70c5.zip
Merge pull request #17263 from zeertzjq/vim-8.2.0208
vim-patch:8.2.{0208,0215,0942,3824,3939}: fnamemodify() patches
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r--src/nvim/path.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index fe564182d8..7f7f941e26 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1521,7 +1521,7 @@ void simplify_filename(char_u *filename)
p = filename;
#ifdef BACKSLASH_IN_FILENAME
- if (p[1] == ':') { // skip "x:"
+ if (p[0] != NUL && p[1] == ':') { // skip "x:"
p += 2;
}
#endif
@@ -2402,9 +2402,11 @@ static int path_to_absolute(const char_u *fname, char_u *buf, size_t len, int fo
int path_is_absolute(const char_u *fname)
{
#ifdef WIN32
+ if (*fname == NUL) {
+ return false;
+ }
// A name like "d:/foo" and "//server/share" is absolute
- return ((isalpha(fname[0]) && fname[1] == ':'
- && vim_ispathsep_nocolon(fname[2]))
+ return ((isalpha(fname[0]) && fname[1] == ':' && vim_ispathsep_nocolon(fname[2]))
|| (vim_ispathsep_nocolon(fname[0]) && fname[0] == fname[1]));
#else
// UNIX: This just checks if the file name starts with '/' or '~'.