|
|
78df90 |
diff --git a/rsync.c b/rsync.c
|
|
|
78df90 |
index bcecac63..ff9489be 100644
|
|
|
78df90 |
--- a/rsync.c
|
|
|
78df90 |
+++ b/rsync.c
|
|
|
78df90 |
@@ -63,8 +63,7 @@ extern char *iconv_opt;
|
|
|
78df90 |
#define UPDATED_ATIME (1<<3)
|
|
|
78df90 |
#define UPDATED_ACLS (1<<4)
|
|
|
78df90 |
#define UPDATED_MODE (1<<5)
|
|
|
78df90 |
-
|
|
|
78df90 |
-#define UPDATED_TIMES (UPDATED_MTIME|UPDATED_ATIME)
|
|
|
78df90 |
+#define UPDATED_CRTIME (1<<6)
|
|
|
78df90 |
|
|
|
78df90 |
#ifdef ICONV_CONST
|
|
|
78df90 |
iconv_t ic_chck = (iconv_t)-1;
|
|
|
78df90 |
@@ -576,10 +575,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
|
|
78df90 |
set_xattr(fname, file, fnamecmp, sxp);
|
|
|
78df90 |
#endif
|
|
|
78df90 |
|
|
|
78df90 |
- if (!preserve_times
|
|
|
78df90 |
- || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
|
|
|
78df90 |
- || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
|
|
|
78df90 |
- flags |= ATTRS_SKIP_MTIME | ATTRS_SKIP_ATIME;
|
|
|
78df90 |
+ if (!preserve_times)
|
|
|
78df90 |
+ flags |= ATTRS_SKIP_MTIME | (atimes_ndx ? 0 : ATTRS_SKIP_ATIME) | (crtimes_ndx ? 0 : ATTRS_SKIP_CRTIME);
|
|
|
78df90 |
+ else if ((!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
|
|
|
78df90 |
+ || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
|
|
|
78df90 |
+ flags |= ATTRS_SKIP_MTIME | ATTRS_SKIP_ATIME | ATTRS_SKIP_CRTIME;
|
|
|
78df90 |
else if (sxp != &sx2)
|
|
|
78df90 |
memcpy(&sx2.st, &sxp->st, sizeof (sx2.st));
|
|
|
78df90 |
if (!atimes_ndx || S_ISDIR(sxp->st.st_mode))
|
|
|
78df90 |
@@ -606,7 +606,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
|
|
78df90 |
updated |= UPDATED_ATIME;
|
|
|
78df90 |
}
|
|
|
78df90 |
}
|
|
|
78df90 |
- if (updated & UPDATED_TIMES) {
|
|
|
78df90 |
+ if (updated & (UPDATED_MTIME|UPDATED_ATIME)) {
|
|
|
78df90 |
int ret = set_times(fname, &sx2.st);
|
|
|
78df90 |
if (ret < 0) {
|
|
|
78df90 |
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
|
|
|
78df90 |
@@ -614,7 +614,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
|
|
78df90 |
goto cleanup;
|
|
|
78df90 |
}
|
|
|
78df90 |
if (ret > 0) { /* ret == 1 if symlink could not be set */
|
|
|
78df90 |
- updated &= ~UPDATED_TIMES;
|
|
|
78df90 |
+ updated &= ~(UPDATED_MTIME|UPDATED_ATIME);
|
|
|
78df90 |
file->flags |= FLAG_TIME_FAILED;
|
|
|
78df90 |
}
|
|
|
78df90 |
}
|