Mercurial > vim
comparison src/fileio.c @ 6243:54194bd6ed60 v7.4.456
updated for version 7.4.456
Problem: 'backupcopy' is global, cannot write only some files in a
different way.
Solution: Make 'backupcopy' global-local. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 23 Sep 2014 15:45:08 +0200 |
parents | 52fa8300ce20 |
children | a0daa5feaccb |
comparison
equal
deleted
inserted
replaced
6242:edb2f4f3547d | 6243:54194bd6ed60 |
---|---|
3147 #endif | 3147 #endif |
3148 #ifdef FEAT_PERSISTENT_UNDO | 3148 #ifdef FEAT_PERSISTENT_UNDO |
3149 int write_undo_file = FALSE; | 3149 int write_undo_file = FALSE; |
3150 context_sha256_T sha_ctx; | 3150 context_sha256_T sha_ctx; |
3151 #endif | 3151 #endif |
3152 unsigned int bkc = get_bkc_value(buf); | |
3152 | 3153 |
3153 if (fname == NULL || *fname == NUL) /* safety check */ | 3154 if (fname == NULL || *fname == NUL) /* safety check */ |
3154 return FAIL; | 3155 return FAIL; |
3155 if (buf->b_ml.ml_mfp == NULL) | 3156 if (buf->b_ml.ml_mfp == NULL) |
3156 { | 3157 { |
3645 { | 3646 { |
3646 #if defined(UNIX) || defined(WIN32) | 3647 #if defined(UNIX) || defined(WIN32) |
3647 struct stat st; | 3648 struct stat st; |
3648 #endif | 3649 #endif |
3649 | 3650 |
3650 if ((bkc_flags & BKC_YES) || append) /* "yes" */ | 3651 if ((bkc & BKC_YES) || append) /* "yes" */ |
3651 backup_copy = TRUE; | 3652 backup_copy = TRUE; |
3652 #if defined(UNIX) || defined(WIN32) | 3653 #if defined(UNIX) || defined(WIN32) |
3653 else if ((bkc_flags & BKC_AUTO)) /* "auto" */ | 3654 else if ((bkc & BKC_AUTO)) /* "auto" */ |
3654 { | 3655 { |
3655 int i; | 3656 int i; |
3656 | 3657 |
3657 # ifdef UNIX | 3658 # ifdef UNIX |
3658 /* | 3659 /* |
3736 } | 3737 } |
3737 | 3738 |
3738 /* | 3739 /* |
3739 * Break symlinks and/or hardlinks if we've been asked to. | 3740 * Break symlinks and/or hardlinks if we've been asked to. |
3740 */ | 3741 */ |
3741 if ((bkc_flags & BKC_BREAKSYMLINK) || (bkc_flags & BKC_BREAKHARDLINK)) | 3742 if ((bkc & BKC_BREAKSYMLINK) || (bkc & BKC_BREAKHARDLINK)) |
3742 { | 3743 { |
3743 # ifdef UNIX | 3744 # ifdef UNIX |
3744 int lstat_res; | 3745 int lstat_res; |
3745 | 3746 |
3746 lstat_res = mch_lstat((char *)fname, &st); | 3747 lstat_res = mch_lstat((char *)fname, &st); |
3747 | 3748 |
3748 /* Symlinks. */ | 3749 /* Symlinks. */ |
3749 if ((bkc_flags & BKC_BREAKSYMLINK) | 3750 if ((bkc & BKC_BREAKSYMLINK) |
3750 && lstat_res == 0 | 3751 && lstat_res == 0 |
3751 && st.st_ino != st_old.st_ino) | 3752 && st.st_ino != st_old.st_ino) |
3752 backup_copy = FALSE; | 3753 backup_copy = FALSE; |
3753 | 3754 |
3754 /* Hardlinks. */ | 3755 /* Hardlinks. */ |
3755 if ((bkc_flags & BKC_BREAKHARDLINK) | 3756 if ((bkc & BKC_BREAKHARDLINK) |
3756 && st_old.st_nlink > 1 | 3757 && st_old.st_nlink > 1 |
3757 && (lstat_res != 0 || st.st_ino == st_old.st_ino)) | 3758 && (lstat_res != 0 || st.st_ino == st_old.st_ino)) |
3758 backup_copy = FALSE; | 3759 backup_copy = FALSE; |
3759 # else | 3760 # else |
3760 # if defined(WIN32) | 3761 # if defined(WIN32) |
3761 /* Symlinks. */ | 3762 /* Symlinks. */ |
3762 if ((bkc_flags & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) | 3763 if ((bkc & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) |
3763 backup_copy = FALSE; | 3764 backup_copy = FALSE; |
3764 | 3765 |
3765 /* Hardlinks. */ | 3766 /* Hardlinks. */ |
3766 if ((bkc_flags & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) | 3767 if ((bkc & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) |
3767 backup_copy = FALSE; | 3768 backup_copy = FALSE; |
3768 # endif | 3769 # endif |
3769 # endif | 3770 # endif |
3770 } | 3771 } |
3771 | 3772 |