Avoid setting creation time on root dir of HFS+ volume.
authorWayne Davison <wayned@samba.org>
Sat, 18 Sep 2010 17:22:42 +0000 (10:22 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 18 Sep 2010 17:22:42 +0000 (10:22 -0700)
Fixes #7685.

crtimes.diff

index 8d90ab880044020c923a521de69a8e1a0e61568b..227a3f6cd1a3847be86569d5d56a25f64d8d9cfa 100644 (file)
@@ -297,7 +297,17 @@ diff --git a/options.c b/options.c
 diff --git a/rsync.c b/rsync.c
 --- a/rsync.c
 +++ b/rsync.c
-@@ -540,6 +540,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -527,6 +527,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+        || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
+        || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
+               flags |= ATTRS_SKIP_MTIME;
++      /* Don't set the creation date on the root folder of an HFS+ volume. */
++      if (sxp->st.st_ino == 2 && S_ISDIR(sxp->st.st_mode))
++              flags |= ATTRS_SKIP_CRTIME;
+       if (!(flags & ATTRS_SKIP_MTIME)
+           && cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
+               int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode, ST_FLAGS(sxp->st));
+@@ -540,6 +543,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
                else
                        file->flags |= FLAG_TIME_FAILED;
        }
@@ -312,7 +322,7 @@ diff --git a/rsync.c b/rsync.c
  
        change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
        change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
-@@ -690,7 +698,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -690,7 +701,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
        /* Change permissions before putting the file into place. */
        set_file_attrs(fnametmp, file, NULL, fnamecmp,
                       ATTRS_DELAY_IMMUTABLE
@@ -321,7 +331,7 @@ diff --git a/rsync.c b/rsync.c
  
        /* move tmp file over real file */
        if (DEBUG_GTE(RECV, 1))
-@@ -719,7 +727,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -719,7 +730,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
  
    do_set_file_attrs:
        set_file_attrs(fnametmp, file, NULL, fnamecmp,