{
char buf[MAXPATHLEN];
const char *copy_to, *partialptr;
+ int save_preserve_xattrs = preserve_xattrs;
int ok, fd_w;
if (inplace) {
return -1;
}
partialptr = partial_dir ? partial_dir_fname(dest) : NULL;
+ preserve_xattrs = 0; /* xattrs were copied with file */
ok = finish_transfer(dest, copy_to, src, partialptr, file, 1, 0);
+ preserve_xattrs = save_preserve_xattrs;
cleanup_disable();
return ok ? 0 : -1;
}
if (f_copy >= 0)
close(f_copy);
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs)
+ if (preserve_xattrs) {
copy_xattrs(fname, backupptr);
+ preserve_xattrs = 0;
+ }
#endif
- preserve_xattrs = 0;
set_file_attrs(backupptr, back_file, NULL, NULL, 0);
preserve_xattrs = save_preserve_xattrs;
if (verbose > 1) {
if (make_backups > 0 && overwriting_basis) {
if (!make_backup(fname))
return 1;
- fnamecmp = get_backup_name(fname);
+ if (fnamecmp == fname)
+ fnamecmp = get_backup_name(fname);
}
/* Change permissions before putting the file into place. */