]> granicus.if.org Git - vim/commitdiff
patch 7.4.1007 v7.4.1007
authorBram Moolenaar <Bram@vim.org>
Thu, 31 Dec 2015 17:29:46 +0000 (18:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 31 Dec 2015 17:29:46 +0000 (18:29 +0100)
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)

src/os_unix.c
src/version.c

index 314a906d6135d0e5ca5e0babbd644e1edb73f6a4..4c63eeba14566d4568adef09ec82c8391a1458f4 100644 (file)
@@ -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
index 965eec415af4d72dbd010d6dcdf23ae97271123f..089546fd0f28c6f6c27435a34b63134a55726fde 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1007,
 /**/
     1006,
 /**/