summaryrefslogtreecommitdiff
path: root/rsync.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-08-09 20:57:10 +0000
committerWayne Davison <wayned@samba.org>2004-08-09 20:57:10 +0000
commitebeacb36fb298218bf4195ba3bdddaf8752488bb (patch)
treeec1c6d93f5b3a55e03b52aea29d23fadb5cef711 /rsync.c
parent6558854dbe14f62cb3713da897b55b9dbaac43eb (diff)
downloadrsync-ebeacb36fb298218bf4195ba3bdddaf8752488bb.tar.gz
Set each file's permissions and modtime before it gets renamed.
Diffstat (limited to 'rsync.c')
-rw-r--r--rsync.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/rsync.c b/rsync.c
index 48aa610d..a97357d9 100644
--- a/rsync.c
+++ b/rsync.c
@@ -248,6 +248,9 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file,
goto do_set_perms;
}
+ /* Change permissions before putting the file into place. */
+ set_perms(fnametmp, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
+
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
@@ -259,11 +262,15 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file,
do_unlink(fnametmp);
return;
}
+ if (ret == 0) {
+ /* The file was moved into place (not copied), so it's done. */
+ return;
+ }
do_set_perms:
set_perms(fname, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
}
const char *who_am_i(void)
{
- return am_sender ? "sender" : am_generator ? "generator" : "receiver";
+ return am_sender ? "sender" : am_generator ? "generator" : "receiver";
}