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:
14
src/fileio.c
14
src/fileio.c
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user