summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-12-31 18:29:46 +0100
committerBram Moolenaar <Bram@vim.org>2015-12-31 18:29:46 +0100
commite3303cb0817e826e3c25d5dc4ac10b569d0841e1 (patch)
tree8d417b8b4a9b50ab81d4bc738a3b84937fed5f8a /src/os_unix.c
parent96c664af27ec9535f2c3cd9b889faad3e9460ad6 (diff)
downloadvim-git-e3303cb0817e826e3c25d5dc4ac10b569d0841e1.tar.gz
patch 7.4.1007v7.4.1007
Problem: When a symbolic link points to a file in the root directory, the swapfile is not correct. Solution: Do not try getting the full name of a file in the root directory. (Milly, closes #501)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 314a906d6..4c63eeba1 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2507,8 +2507,10 @@ mch_FullName(fname, buf, len, force)
fname = posix_fname;
#endif
- /* expand it if forced or not an absolute path */
- if (force || !mch_isFullName(fname))
+ /* Expand it if forced or not an absolute path.
+ * Do not do it for "/file", the result is always "/". */
+ if ((force || !mch_isFullName(fname))
+ && ((p = vim_strrchr(fname, '/')) == NULL || p != fname))
{
/*
* If the file name has a path, change to that directory for a moment,
@@ -2517,11 +2519,11 @@ mch_FullName(fname, buf, len, force)
*/
#ifdef OS2
only_drive = 0;
- if (((p = vim_strrchr(fname, '/')) != NULL)
+ if (p != NULL
|| ((p = vim_strrchr(fname, '\\')) != NULL)
|| (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive))
#else
- if ((p = vim_strrchr(fname, '/')) != NULL)
+ if (p != NULL)
#endif
{
#ifdef HAVE_FCHDIR