aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/bufwrite.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-30 22:38:09 +0800
committerGitHub <noreply@github.com>2023-09-30 22:38:09 +0800
commit386bc23e4378f3c161efc924de49a21b2b2c305f (patch)
treecea40ee1e822576a21ed3ef7d00ef474186f5720 /src/nvim/bufwrite.c
parenta4132e1d62c5ef542a05b5ca2c6704f6d992c818 (diff)
parent5c60fbe9db0005d10d87ba60a981fd41f85f8df5 (diff)
downloadrneovim-386bc23e4378f3c161efc924de49a21b2b2c305f.tar.gz
rneovim-386bc23e4378f3c161efc924de49a21b2b2c305f.tar.bz2
rneovim-386bc23e4378f3c161efc924de49a21b2b2c305f.zip
Merge pull request #25442 from zeertzjq/vim-9.0.1962
vim-patch:9.0.{1962,1963}: extended attributes
Diffstat (limited to 'src/nvim/bufwrite.c')
-rw-r--r--src/nvim/bufwrite.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c
index 40b95e5790..db813a3ae1 100644
--- a/src/nvim/bufwrite.c
+++ b/src/nvim/bufwrite.c
@@ -913,6 +913,9 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
&& os_chown(*backupp, (uv_uid_t)-1, (uv_gid_t)file_info_old->stat.st_gid) != 0) {
os_setperm(*backupp, ((int)perm & 0707) | (((int)perm & 07) << 3));
}
+# ifdef HAVE_XATTR
+ os_copy_xattr(fname, *backupp);
+# endif
#endif
// copy the file
@@ -929,6 +932,9 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
(double)file_info_old->stat.st_mtim.tv_sec);
#endif
os_set_acl(*backupp, acl);
+#ifdef HAVE_XATTR
+ os_copy_xattr(fname, *backupp);
+#endif
*err = set_err(NULL);
break;
}
@@ -1634,6 +1640,12 @@ restore_backup:
end = 0;
}
+ if (!backup_copy) {
+#ifdef HAVE_XATTR
+ os_copy_xattr(backup, wfname);
+#endif
+ }
+
#ifdef UNIX
// When creating a new file, set its owner/group to that of the original
// file. Get the new device and inode number.