]> granicus.if.org Git - vim/commitdiff
patch 8.2.2450: MS-Windows: ADS was not preserved if 'backupcopy' is "yes" v8.2.2450
authorBram Moolenaar <Bram@vim.org>
Mon, 1 Feb 2021 19:35:01 +0000 (20:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 1 Feb 2021 19:35:01 +0000 (20:35 +0100)
Problem:    MS-Windows: ADS was not preserved if 'backupcopy' is "yes".
Solution:   Copy ADS before truncating the file. (Ken Takata, closes #7762)

src/bufwrite.c
src/version.c

index d7c74de35c315cbaeddaa88e42ef2db0478771fa..c7c832cff7006a7eba00d09ae9a4e74eea7a78f6 100644 (file)
@@ -1496,6 +1496,9 @@ buf_write(
 #endif
 #if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
                        mch_copy_sec(fname, backup);
+#endif
+#ifdef MSWIN
+                       (void)mch_copy_file_attribute(fname, backup);
 #endif
                        break;
                    }
@@ -1909,12 +1912,7 @@ restore_backup:
 
 #if defined(MSWIN)
            if (backup != NULL && overwriting && !append)
-           {
-               if (backup_copy)
-                   (void)mch_copy_file_attribute(wfname, backup);
-               else
-                   (void)mch_copy_file_attribute(backup, wfname);
-           }
+               (void)mch_copy_file_attribute(backup, wfname);
 
            if (!overwriting && !append)
            {
index d34839c48adae85bc85a37268babc34bc6b804fb..2ae792c87f1d14d07bde315c76e3d065d689295b 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2450,
 /**/
     2449,
 /**/