Skip to content

Commit

Permalink
A cuple more fixes for --xattrs combined with --backup, this time to
Browse files Browse the repository at this point in the history
handle when --link-dest is also used.
  • Loading branch information
Wayne Davison committed May 22, 2008
1 parent 928da42 commit 4337eeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ static int copy_altdest_file(const char *src, const char *dest, struct file_stru
{
char buf[MAXPATHLEN];
const char *copy_to, *partialptr;
int save_preserve_xattrs = preserve_xattrs;
int ok, fd_w;

if (inplace) {
Expand All @@ -946,7 +947,9 @@ static int copy_altdest_file(const char *src, const char *dest, struct file_stru
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;
}
Expand Down Expand Up @@ -1948,10 +1951,11 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
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) {
Expand Down
3 changes: 2 additions & 1 deletion rsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
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. */
Expand Down

0 comments on commit 4337eeb

Please sign in to comment.