0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.3.1182

Problem:    'backupcopy' default on MS-Windows does not work for hard and soft
            links.
Solution:   Check for links. (David Pope, Ken Takata)
This commit is contained in:
Bram Moolenaar
2013-06-12 22:41:37 +02:00
parent 2a876e40ce
commit 12b559e7c3
4 changed files with 219 additions and 75 deletions

View File

@@ -3780,12 +3780,12 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
}
}
# ifdef UNIX
/*
* Break symlinks and/or hardlinks if we've been asked to.
*/
if ((bkc_flags & BKC_BREAKSYMLINK) || (bkc_flags & BKC_BREAKHARDLINK))
{
# ifdef UNIX
int lstat_res;
lstat_res = mch_lstat((char *)fname, &st);
@@ -3801,8 +3801,18 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
&& st_old.st_nlink > 1
&& (lstat_res != 0 || st.st_ino == st_old.st_ino))
backup_copy = FALSE;
# else
# if defined(WIN32)
/* Symlinks. */
if ((bkc_flags & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname))
backup_copy = FALSE;
/* Hardlinks. */
if ((bkc_flags & BKC_BREAKHARDLINK) && mch_is_hard_link(fname))
backup_copy = FALSE;
# endif
# endif
}
#endif
#endif