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.
extern int verbose;
extern int dry_run;
extern int preserve_times;
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;
extern int am_root;
extern int am_server;
extern int am_sender;
}
int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
}
int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
{
int updated = 0;
STRUCT_STAT st2;
{
int updated = 0;
STRUCT_STAT 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 &&
/* don't complain about not setting times on directories
* because some filesystems can't do it */
if (set_modtime(fname,file->modtime) != 0 &&
- if (verbose > 1 && report) {
+ if (verbose > 1 && flags & PERMS_REPORT) {
if (updated)
rprintf(FINFO,"%s\n",fname);
else
if (updated)
rprintf(FINFO,"%s\n",fname);
else
/* finish off a file transfer, renaming the file and setting the permissions
and ownership */
/* 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)
full_fname(fnametmp), fname, strerror(errno));
do_unlink(fnametmp);
} else {
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);