comparison src/os_unix.c @ 7406:c97735aaef9f v7.4.1007

commit https://github.com/vim/vim/commit/e3303cb0817e826e3c25d5dc4ac10b569d0841e1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 31 18:29:46 2015 +0100 patch 7.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)
author Christian Brabandt <cb@256bit.org>
date Thu, 31 Dec 2015 18:30:05 +0100
parents 89c6f7c6704a
children 1886f2863437
comparison
equal deleted inserted replaced
7405:b2eab967e487 7406:c97735aaef9f
2505 cygwin_conv_to_posix_path(fname, posix_fname); 2505 cygwin_conv_to_posix_path(fname, posix_fname);
2506 # endif 2506 # endif
2507 fname = posix_fname; 2507 fname = posix_fname;
2508 #endif 2508 #endif
2509 2509
2510 /* expand it if forced or not an absolute path */ 2510 /* Expand it if forced or not an absolute path.
2511 if (force || !mch_isFullName(fname)) 2511 * Do not do it for "/file", the result is always "/". */
2512 if ((force || !mch_isFullName(fname))
2513 && ((p = vim_strrchr(fname, '/')) == NULL || p != fname))
2512 { 2514 {
2513 /* 2515 /*
2514 * If the file name has a path, change to that directory for a moment, 2516 * If the file name has a path, change to that directory for a moment,
2515 * and then do the getwd() (and get back to where we were). 2517 * and then do the getwd() (and get back to where we were).
2516 * This will get the correct path name with "../" things. 2518 * This will get the correct path name with "../" things.
2517 */ 2519 */
2518 #ifdef OS2 2520 #ifdef OS2
2519 only_drive = 0; 2521 only_drive = 0;
2520 if (((p = vim_strrchr(fname, '/')) != NULL) 2522 if (p != NULL
2521 || ((p = vim_strrchr(fname, '\\')) != NULL) 2523 || ((p = vim_strrchr(fname, '\\')) != NULL)
2522 || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) 2524 || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive))
2523 #else 2525 #else
2524 if ((p = vim_strrchr(fname, '/')) != NULL) 2526 if (p != NULL)
2525 #endif 2527 #endif
2526 { 2528 {
2527 #ifdef HAVE_FCHDIR 2529 #ifdef HAVE_FCHDIR
2528 /* 2530 /*
2529 * Use fchdir() if possible, it's said to be faster and more 2531 * Use fchdir() if possible, it's said to be faster and more