aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/bufwrite.c
diff options
context:
space:
mode:
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.