aboutsummaryrefslogtreecommitdiffstats
path: root/rsync.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-05-13 07:08:25 +0000
committerWayne Davison <wayned@samba.org>2004-05-13 07:08:25 +0000
commit4ecc9e6b64f568f5ca6e98448c953d95c68bb3a3 (patch)
tree77710c5d7c939c2c6e95a862ec81bd6a8893eaf8 /rsync.c
parent55e50d890b6bfab9e75f2d72fe877dabd721cf49 (diff)
downloadandroid_external_rsync-4ecc9e6b64f568f5ca6e98448c953d95c68bb3a3.tar.gz
android_external_rsync-4ecc9e6b64f568f5ca6e98448c953d95c68bb3a3.tar.bz2
android_external_rsync-4ecc9e6b64f568f5ca6e98448c953d95c68bb3a3.zip
The finish_transfer() call takes an arg that specifies if we should set the
modtime or not on the finished file. It calls set_perms(), which now takes a flag arg that allows us to specify if we want to skip the modtime modification.
Diffstat (limited to 'rsync.c')
-rw-r--r--rsync.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/rsync.c b/rsync.c
index 1eab8ab6..5d50746e 100644
--- a/rsync.c
+++ b/rsync.c
@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
extern int preserve_times;
+extern int preserve_dir_times;
extern int am_root;
extern int am_server;
extern int am_sender;
@@ -123,7 +124,7 @@ int delete_file(char *fname)
}
int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
- int report)
+ int flags)
{
int updated = 0;
STRUCT_STAT st2;
@@ -140,8 +141,10 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
st = &st2;
}
- if (preserve_times && !S_ISLNK(st->st_mode) &&
- cmp_modtime(st->st_mtime, file->modtime) != 0) {
+ if (!preserve_times || S_ISLNK(st->st_mode))
+ flags |= PERMS_SKIP_TIME;
+ if (!(flags & PERMS_SKIP_TIME)
+ && cmp_modtime(st->st_mtime, file->modtime) != 0) {
/* don't complain about not setting times on directories
* because some filesystems can't do it */
if (set_modtime(fname,file->modtime) != 0 &&
@@ -201,7 +204,7 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
}
#endif
- if (verbose > 1 && report) {
+ if (verbose > 1 && flags & PERMS_REPORT) {
if (updated)
rprintf(FINFO,"%s\n",fname);
else
@@ -228,7 +231,8 @@ void sig_int(void)
/* finish off a file transfer, renaming the file and setting the permissions
and ownership */
-void finish_transfer(char *fname, char *fnametmp, struct file_struct *file)
+void finish_transfer(char *fname, char *fnametmp, struct file_struct *file,
+ int ok_to_set_time)
{
int ret;
@@ -243,7 +247,8 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file)
full_fname(fnametmp), fname, strerror(errno));
do_unlink(fnametmp);
} else {
- set_perms(fname,file,NULL,0);
+ set_perms(fname, file, NULL,
+ ok_to_set_time ? 0 : PERMS_SKIP_TIME);
}
}