Fixed a problem when --crtimes was combined with --hard-links.
authorWayne Davison <wayne@opencoder.net>
Sat, 11 Oct 2008 18:44:40 +0000 (11:44 -0700)
committerWayne Davison <wayne@opencoder.net>
Sat, 11 Oct 2008 18:44:40 +0000 (11:44 -0700)
crtimes.diff

index b73444f..af7ffef 100644 (file)
@@ -89,7 +89,16 @@ diff --git a/flist.c b/flist.c
        static mode_t mode;
  #ifdef SUPPORT_FILEFLAGS
        static uint32 fileflags;
-@@ -773,6 +783,19 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -744,6 +754,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+                               uid = F_OWNER(first);
+                       if (preserve_gid)
+                               gid = F_GROUP(first);
++                      if (crtimes_ndx)
++                              crtime = f_crtime(first);
+                       if ((preserve_devices && IS_DEVICE(mode))
+                        || (preserve_specials && IS_SPECIAL(mode))) {
+                               uint32 *devp = F_RDEV_P(first);
+@@ -773,6 +785,19 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                } else
                        modtime = read_int(f);
        }
@@ -109,7 +118,7 @@ diff --git a/flist.c b/flist.c
        if (!(xflags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
  
-@@ -932,6 +955,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -932,6 +957,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                F_GROUP(file) = gid;
                file->flags |= gid_flags;
        }
@@ -118,7 +127,7 @@ diff --git a/flist.c b/flist.c
        if (unsort_ndx)
                F_NDX(file) = flist->used + flist->ndx_start;
  
-@@ -1308,6 +1333,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1308,6 +1335,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                F_OWNER(file) = st.st_uid;
        if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */
                F_GROUP(file) = st.st_gid;
@@ -208,6 +217,25 @@ diff --git a/generator.c b/generator.c
  
  #ifdef SUPPORT_ACLS
        sx.acc_acl = sx.def_acl = NULL;
+diff --git a/hlink.c b/hlink.c
+--- a/hlink.c
++++ b/hlink.c
+@@ -366,6 +366,7 @@ int hard_link_check(struct file_struct *file, int ndx, const char *fname,
+               char cmpbuf[MAXPATHLEN];
+               stat_x alt_sx;
+               int j = 0;
++              alt_sx.crtime = 0;
+ #ifdef SUPPORT_ACLS
+               alt_sx.acc_acl = alt_sx.def_acl = NULL;
+ #endif
+@@ -494,6 +495,7 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
+       } else
+               our_name = fname;
++      prev_sx.crtime = 0;
+ #ifdef SUPPORT_ACLS
+       prev_sx.acc_acl = prev_sx.def_acl = NULL;
+ #endif
 diff --git a/ifuncs.h b/ifuncs.h
 --- a/ifuncs.h
 +++ b/ifuncs.h
@@ -294,7 +322,15 @@ diff --git a/options.c b/options.c
 diff --git a/rsync.c b/rsync.c
 --- a/rsync.c
 +++ b/rsync.c
-@@ -472,6 +472,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -428,6 +428,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+                               full_fname(fname));
+                       return 0;
+               }
++              sx2.crtime = 0;
+ #ifdef SUPPORT_ACLS
+               sx2.acc_acl = sx2.def_acl = NULL;
+ #endif
+@@ -475,6 +476,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
                else
                        file->flags |= FLAG_TIME_FAILED;
        }
@@ -309,7 +345,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)
-@@ -619,7 +627,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -622,7 +631,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
@@ -318,7 +354,7 @@ diff --git a/rsync.c b/rsync.c
  
        /* move tmp file over real file */
        if (verbose > 2)
-@@ -650,7 +658,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -653,7 +662,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
  
    do_set_file_attrs:
        set_file_attrs(fnametmp, file, NULL, fnamecmp,
@@ -371,7 +407,7 @@ diff --git a/rsync.h b/rsync.h
  #define DEV_EXTRA_CNT 2
  #define DIRNODE_EXTRA_CNT 3
  #define SUM_EXTRA_CNT ((MAX_DIGEST_LEN + EXTRA_LEN - 1) / EXTRA_LEN)
-@@ -922,6 +926,7 @@ typedef struct {
+@@ -931,6 +935,7 @@ typedef struct {
  
  typedef struct {
      STRUCT_STAT st;