diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-05 21:14:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-05 21:14:00 +0100 |
commit | a78e9c61a0ded9c5302bc77e889aa1b3d3467f61 (patch) | |
tree | aa7685b88fa9a735d406d6bf2f86a05f34de41f6 /src/filepath.c | |
parent | 2e6638d5f03ae183999c726ba63e528d556342c0 (diff) | |
download | vim-git-a78e9c61a0ded9c5302bc77e889aa1b3d3467f61.tar.gz |
patch 8.2.0215: wrong file name shorteningv8.2.0215
Problem: Wrong file name shortening. (Ingo Karkat)
Solution: Better check for path separator. (Yasuhiro Matsumoto,
closes #5583, closes #5584)
Diffstat (limited to 'src/filepath.c')
-rw-r--r-- | src/filepath.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/filepath.c b/src/filepath.c index 9a5d127ec..79eb7bf98 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -448,14 +448,18 @@ repeat: if (fnamencmp(p, dirname, namelen) == 0) { p += namelen; - while (*p && vim_ispathsep(*p)) - ++p; - *fnamep = p; - if (pbuf != NULL) + if (vim_ispathsep(*p)) { - vim_free(*bufp); // free any allocated file name - *bufp = pbuf; - pbuf = NULL; + while (*p && vim_ispathsep(*p)) + ++p; + *fnamep = p; + if (pbuf != NULL) + { + // free any allocated file name + vim_free(*bufp); + *bufp = pbuf; + pbuf = NULL; + } } } } |