comparison src/bufwrite.c @ 23817:e6b37eca27b6 v8.2.2450

patch 8.2.2450: MS-Windows: ADS was not preserved if 'backupcopy' is "yes" Commit: https://github.com/vim/vim/commit/7781ebe50f6d4daba02be3bd7e6ca08cd459674b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 1 20:35:01 2021 +0100 patch 8.2.2450: MS-Windows: ADS was not preserved if 'backupcopy' is "yes" Problem: MS-Windows: ADS was not preserved if 'backupcopy' is "yes". Solution: Copy ADS before truncating the file. (Ken Takata, closes https://github.com/vim/vim/issues/7762)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Feb 2021 20:45:04 +0100
parents 4d6c1b17f66a
children 7e9e53a0368f
comparison
equal deleted inserted replaced
23816:525c9e218c69 23817:e6b37eca27b6
1495 mch_set_acl(backup, acl); 1495 mch_set_acl(backup, acl);
1496 #endif 1496 #endif
1497 #if defined(HAVE_SELINUX) || defined(HAVE_SMACK) 1497 #if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
1498 mch_copy_sec(fname, backup); 1498 mch_copy_sec(fname, backup);
1499 #endif 1499 #endif
1500 #ifdef MSWIN
1501 (void)mch_copy_file_attribute(fname, backup);
1502 #endif
1500 break; 1503 break;
1501 } 1504 }
1502 } 1505 }
1503 } 1506 }
1504 nobackup: 1507 nobackup:
1907 vim_ignored = ftruncate(fd, (off_t)0); 1910 vim_ignored = ftruncate(fd, (off_t)0);
1908 #endif 1911 #endif
1909 1912
1910 #if defined(MSWIN) 1913 #if defined(MSWIN)
1911 if (backup != NULL && overwriting && !append) 1914 if (backup != NULL && overwriting && !append)
1912 { 1915 (void)mch_copy_file_attribute(backup, wfname);
1913 if (backup_copy)
1914 (void)mch_copy_file_attribute(wfname, backup);
1915 else
1916 (void)mch_copy_file_attribute(backup, wfname);
1917 }
1918 1916
1919 if (!overwriting && !append) 1917 if (!overwriting && !append)
1920 { 1918 {
1921 if (buf->b_ffname != NULL) 1919 if (buf->b_ffname != NULL)
1922 (void)mch_copy_file_attribute(buf->b_ffname, wfname); 1920 (void)mch_copy_file_attribute(buf->b_ffname, wfname);