summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-30 21:26:16 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-30 21:26:16 +0200
commit4eaef9979fc5032606897963f1af37674ee0d422 (patch)
tree07992e60f3c84fae3bfa15b4916de9fd3a44e53e /src/os_unix.c
parentde05ae71589f46c5d27642c33fe5eb21b22aaf5d (diff)
downloadvim-git-4eaef9979fc5032606897963f1af37674ee0d422.tar.gz
patch 8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../'v8.2.3388
Problem: fnamemodify('path/..', ':p') differs from using 'path/../'. Solution: Include the "/.." in the directory name. (closes #8808)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index b603927e3..a3e5430ef 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2602,6 +2602,10 @@ mch_FullName(
*/
if (p != NULL)
{
+ if (STRCMP(p, "/..") == 0)
+ // for "/path/dir/.." include the "/.."
+ p += 3;
+
#ifdef HAVE_FCHDIR
/*
* Use fchdir() if possible, it's said to be faster and more
@@ -2644,8 +2648,10 @@ mch_FullName(
vim_strncpy(buf, fname, p - fname);
if (mch_chdir((char *)buf))
retval = FAIL;
- else
+ else if (*p == '/')
fname = p + 1;
+ else
+ fname = p;
*buf = NUL;
}
}