Blame SOURCES/rsync-3.2.3-atimes.patch

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