Fixed failing hunks.
authorWayne Davison <wayned@samba.org>
Tue, 20 Feb 2007 05:35:43 +0000 (05:35 +0000)
committerWayne Davison <wayned@samba.org>
Tue, 20 Feb 2007 05:35:43 +0000 (05:35 +0000)
acls.diff
omit-dir-changes.diff

index 910efd6..215749f 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -1128,7 +1128,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +#endif /* SUPPORT_ACLS */
 --- old/backup.c
 +++ new/backup.c
-@@ -23,6 +23,7 @@
+@@ -22,6 +22,7 @@
  
  extern int verbose;
  extern int am_root;
@@ -1136,7 +1136,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_devices;
  extern int preserve_specials;
  extern int preserve_links;
-@@ -93,7 +94,8 @@ path
+@@ -92,7 +93,8 @@ path
  ****************************************************************************/
  static int make_bak_dir(char *fullpath)
  {
@@ -1146,7 +1146,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char *rel = fullpath + backup_dir_len;
        char *end = rel + strlen(rel);
        char *p = end;
-@@ -125,15 +127,24 @@ static int make_bak_dir(char *fullpath)
+@@ -124,15 +126,24 @@ static int make_bak_dir(char *fullpath)
                if (p >= rel) {
                        /* Try to transfer the directory settings of the
                         * actual dir that the files are coming from. */
@@ -1175,7 +1175,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        }
                }
                *p = '/';
-@@ -171,15 +182,18 @@ static int robust_move(const char *src, 
+@@ -170,15 +181,18 @@ static int robust_move(const char *src, 
   * We will move the file to be deleted into a parallel directory tree. */
  static int keep_backup(const char *fname)
  {
@@ -1196,7 +1196,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
                return 1; /* the file could have disappeared */
-@@ -189,6 +203,13 @@ static int keep_backup(const char *fname
+@@ -188,6 +202,13 @@ static int keep_backup(const char *fname
                return 0;
        }
  
@@ -1210,7 +1210,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        /* Check to see if this is a device file, or link */
        if ((am_root && preserve_devices && IS_DEVICE(file->mode))
         || (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -260,7 +281,7 @@ static int keep_backup(const char *fname
+@@ -259,7 +280,7 @@ static int keep_backup(const char *fname
                if (robust_move(fname, buf) != 0) {
                        rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"",
                                full_fname(fname), buf);
@@ -1221,7 +1221,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        robust_unlink(fname); /* Just in case... */
 --- old/compat.c
 +++ new/compat.c
-@@ -56,6 +56,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -55,6 +55,8 @@ void setup_protocol(int f_out,int f_in)
                preserve_uid = ++file_extra_cnt;
        if (preserve_gid)
                preserve_gid = ++file_extra_cnt;
@@ -1325,7 +1325,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/flist.c
 +++ new/flist.c
-@@ -42,6 +42,7 @@ extern int filesfrom_fd;
+@@ -41,6 +41,7 @@ extern int filesfrom_fd;
  extern int one_file_system;
  extern int copy_dirlinks;
  extern int keep_dirlinks;
@@ -1333,7 +1333,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_links;
  extern int preserve_hard_links;
  extern int preserve_devices;
-@@ -153,6 +154,8 @@ static void list_file_entry(struct file_
+@@ -152,6 +153,8 @@ static void list_file_entry(struct file_
        permstring(permbuf, f->mode);
        len = F_LENGTH(f);
  
@@ -1342,7 +1342,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #ifdef SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
                rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
-@@ -715,6 +718,12 @@ static struct file_struct *recv_file_ent
+@@ -714,6 +717,12 @@ static struct file_struct *recv_file_ent
        }
  #endif
  
@@ -1355,7 +1355,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (always_checksum && S_ISREG(mode))
                extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
  
-@@ -852,6 +861,11 @@ static struct file_struct *recv_file_ent
+@@ -851,6 +860,11 @@ static struct file_struct *recv_file_ent
                        read_buf(f, bp, checksum_len);
        }
  
@@ -1367,7 +1367,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (S_ISREG(mode) || S_ISLNK(mode))
                stats.total_size += file_length;
  
-@@ -1123,6 +1137,9 @@ static struct file_struct *send_file_nam
+@@ -1122,6 +1136,9 @@ static struct file_struct *send_file_nam
                                          int flags, int filter_flags)
  {
        struct file_struct *file;
@@ -1377,7 +1377,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        file = make_file(fname, flist, stp, flags, filter_flags);
        if (!file)
-@@ -1131,12 +1148,26 @@ static struct file_struct *send_file_nam
+@@ -1130,12 +1147,26 @@ static struct file_struct *send_file_nam
        if (chmod_modes && !S_ISLNK(file->mode))
                file->mode = tweak_mode(file->mode, chmod_modes);
  
@@ -1407,7 +1407,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/generator.c
 +++ new/generator.c
-@@ -36,6 +36,7 @@ extern int do_progress;
+@@ -35,6 +35,7 @@ extern int do_progress;
  extern int relative_paths;
  extern int implied_dirs;
  extern int keep_dirlinks;
@@ -1415,7 +1415,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_links;
  extern int preserve_devices;
  extern int preserve_specials;
-@@ -90,6 +91,7 @@ extern int force_delete;
+@@ -89,6 +90,7 @@ extern int force_delete;
  extern int one_file_system;
  extern struct stats stats;
  extern dev_t filesystem_dev;
@@ -1423,7 +1423,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern char *backup_dir;
  extern char *backup_suffix;
  extern int backup_suffix_len;
-@@ -512,22 +514,27 @@ static void do_delete_pass(struct file_l
+@@ -511,22 +513,27 @@ static void do_delete_pass(struct file_l
                rprintf(FINFO, "                    \r");
  }
  
@@ -1456,7 +1456,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
             const char *xname)
  {
        if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -535,20 +542,24 @@ void itemize(struct file_struct *file, i
+@@ -534,20 +541,24 @@ void itemize(struct file_struct *file, i
                    : S_ISDIR(file->mode) ? !omit_dir_times
                    : !S_ISLNK(file->mode);
  
@@ -1486,7 +1486,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        } else
                iflags |= ITEM_IS_NEW;
  
-@@ -784,7 +795,7 @@ static int find_fuzzy(struct file_struct
+@@ -783,7 +794,7 @@ static int find_fuzzy(struct file_struct
   * handling the file, -1 if no dest-linking occurred, or a non-negative
   * value if we found an alternate basis file. */
  static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
@@ -1495,7 +1495,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         enum logcode code)
  {
        int best_match = -1;
-@@ -793,7 +804,7 @@ static int try_dests_reg(struct file_str
+@@ -792,7 +803,7 @@ static int try_dests_reg(struct file_str
  
        do {
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1504,7 +1504,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        continue;
                switch (match_level) {
                case 0:
-@@ -801,16 +812,20 @@ static int try_dests_reg(struct file_str
+@@ -800,16 +811,20 @@ static int try_dests_reg(struct file_str
                        match_level = 1;
                        /* FALL THROUGH */
                case 1:
@@ -1528,7 +1528,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        best_match = j;
                        match_level = 3;
-@@ -825,7 +840,7 @@ static int try_dests_reg(struct file_str
+@@ -824,7 +839,7 @@ static int try_dests_reg(struct file_str
        if (j != best_match) {
                j = best_match;
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1537,7 +1537,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        return -1;
        }
  
-@@ -835,16 +850,25 @@ static int try_dests_reg(struct file_str
+@@ -834,16 +849,25 @@ static int try_dests_reg(struct file_str
                        if (!hard_link_one(file, fname, cmpbuf, 1))
                                goto try_a_copy;
                        if (preserve_hard_links && F_IS_HLINKED(file))
@@ -1567,7 +1567,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                if (verbose > 1 && maybe_ATTRS_REPORT)
                        rprintf(FCLIENT, "%s is uptodate\n", fname);
                return -2;
-@@ -861,8 +885,13 @@ static int try_dests_reg(struct file_str
+@@ -860,8 +884,13 @@ static int try_dests_reg(struct file_str
                        }
                        return -1;
                }
@@ -1583,7 +1583,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                set_file_attrs(fname, file, NULL, 0);
                if (maybe_ATTRS_REPORT
                 && ((!itemizing && verbose && match_level == 2)
-@@ -873,7 +902,7 @@ static int try_dests_reg(struct file_str
+@@ -872,7 +901,7 @@ static int try_dests_reg(struct file_str
                }
  #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && F_IS_HLINKED(file))
@@ -1592,7 +1592,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #endif
                return -2;
        }
-@@ -885,7 +914,7 @@ static int try_dests_reg(struct file_str
+@@ -884,7 +913,7 @@ static int try_dests_reg(struct file_str
   * handling the file, or -1 if no dest-linking occurred, or a non-negative
   * value if we found an alternate basis file. */
  static int try_dests_non(struct file_struct *file, char *fname, int ndx,
@@ -1601,7 +1601,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         enum logcode code)
  {
        char lnk[MAXPATHLEN];
-@@ -918,24 +947,24 @@ static int try_dests_non(struct file_str
+@@ -917,24 +946,24 @@ static int try_dests_non(struct file_str
  
        do {
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1631,7 +1631,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        break;
  #endif
-@@ -950,7 +979,7 @@ static int try_dests_non(struct file_str
+@@ -949,7 +978,7 @@ static int try_dests_non(struct file_str
                case TYPE_SPECIAL:
                case TYPE_DEVICE:
                        devp = F_RDEV_P(file);
@@ -1640,7 +1640,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        break;
  #ifdef SUPPORT_LINKS
-@@ -967,7 +996,11 @@ static int try_dests_non(struct file_str
+@@ -966,7 +995,11 @@ static int try_dests_non(struct file_str
                        match_level = 2;
                        best_match = j;
                }
@@ -1653,7 +1653,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        match_level = 3;
                        best_match = j;
                        break;
-@@ -980,7 +1013,7 @@ static int try_dests_non(struct file_str
+@@ -979,7 +1012,7 @@ static int try_dests_non(struct file_str
        if (j != best_match) {
                j = best_match;
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1662,7 +1662,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        return -1;
        }
  
-@@ -1011,7 +1044,15 @@ static int try_dests_non(struct file_str
+@@ -1010,7 +1043,15 @@ static int try_dests_non(struct file_str
                            : ITEM_LOCAL_CHANGE
                             + (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0);
                        char *lp = match_level == 3 ? "" : NULL;
@@ -1679,7 +1679,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (verbose > 1 && maybe_ATTRS_REPORT) {
                        rprintf(FCLIENT, "%s%s is uptodate\n",
-@@ -1024,6 +1065,7 @@ static int try_dests_non(struct file_str
+@@ -1023,6 +1064,7 @@ static int try_dests_non(struct file_str
  }
  
  static int phase = 0;
@@ -1687,7 +1687,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
  /* Acts on the indicated item in cur_flist whose name is fname.  If a dir,
   * make sure it exists, and has the right permissions/timestamp info.  For
-@@ -1044,7 +1086,8 @@ static void recv_generator(char *fname, 
+@@ -1043,7 +1085,8 @@ static void recv_generator(char *fname, 
        static int need_fuzzy_dirlist = 0;
        struct file_struct *fuzzy_file = NULL;
        int fd = -1, f_copy = -1;
@@ -1697,7 +1697,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        struct file_struct *back_file = NULL;
        int statret, real_ret, stat_errno;
        char *fnamecmp, *partialptr, *backupptr = NULL;
-@@ -1089,6 +1132,9 @@ static void recv_generator(char *fname, 
+@@ -1088,6 +1131,9 @@ static void recv_generator(char *fname, 
                        return;
                }
        }
@@ -1707,7 +1707,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (dry_run > 1) {
                if (fuzzy_dirlist) {
                        flist_free(fuzzy_dirlist);
-@@ -1101,7 +1147,7 @@ static void recv_generator(char *fname, 
+@@ -1100,7 +1146,7 @@ static void recv_generator(char *fname, 
                const char *dn = file->dirname ? file->dirname : ".";
                if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
                        if (relative_paths && !implied_dirs
@@ -1716,7 +1716,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         && create_directory_path(fname) < 0) {
                                rsyserr(FERROR, errno,
                                        "recv_generator: mkdir %s failed",
-@@ -1113,6 +1159,10 @@ static void recv_generator(char *fname, 
+@@ -1112,6 +1158,10 @@ static void recv_generator(char *fname, 
                        }
                        if (fuzzy_basis)
                                need_fuzzy_dirlist = 1;
@@ -1727,7 +1727,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                parent_dirname = dn;
  
-@@ -1122,7 +1172,7 @@ static void recv_generator(char *fname, 
+@@ -1121,7 +1171,7 @@ static void recv_generator(char *fname, 
                        need_fuzzy_dirlist = 0;
                }
  
@@ -1736,19 +1736,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                    keep_dirlinks && S_ISDIR(file->mode));
                stat_errno = errno;
        }
-@@ -1148,8 +1198,9 @@ static void recv_generator(char *fname, 
-        * mode based on the local permissions and some heuristics. */
-       if (!preserve_perms) {
-               int exists = statret == 0
--                        && S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
--              file->mode = dest_mode(file->mode, st.st_mode, exists);
-+                        && S_ISDIR(sx.st.st_mode) == S_ISDIR(file->mode);
-+              file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
-+                                     exists);
-       }
-       if (S_ISDIR(file->mode)) {
-@@ -1158,8 +1209,8 @@ static void recv_generator(char *fname, 
+@@ -1149,8 +1199,8 @@ static void recv_generator(char *fname, 
                 * file of that name and it is *not* a directory, then
                 * we need to delete it.  If it doesn't exist, then
                 * (perhaps recursively) create it. */
@@ -1759,7 +1747,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                return;
                        statret = -1;
                }
-@@ -1168,14 +1219,14 @@ static void recv_generator(char *fname, 
+@@ -1159,7 +1209,7 @@ static void recv_generator(char *fname, 
                        dry_run++;
                }
                real_ret = statret;
@@ -1768,7 +1756,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                if (new_root_dir) {
                        if (*fname == '.' && fname[1] == '\0')
                                statret = -1;
-                       new_root_dir = 0;
+@@ -1170,7 +1220,7 @@ static void recv_generator(char *fname, 
+                                              statret == 0);
                }
                if (statret != 0 && basis_dir[0] != NULL) {
 -                      int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
@@ -1776,7 +1765,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, code);
                        if (j == -2) {
                                itemizing = 0;
-@@ -1184,7 +1235,11 @@ static void recv_generator(char *fname, 
+@@ -1179,7 +1229,11 @@ static void recv_generator(char *fname, 
                                statret = 1;
                }
                if (itemizing && f_out != -1) {
@@ -1789,7 +1778,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
                }
                if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -1198,31 +1253,31 @@ static void recv_generator(char *fname, 
+@@ -1193,38 +1247,39 @@ static void recv_generator(char *fname, 
                                    "*** Skipping any contents from this failed directory ***\n");
                                missing_below = F_DEPTH(file);
                                file->flags |= FLAG_MISSING_DIR;
@@ -1821,6 +1810,16 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              goto cleanup;
        }
  
+       /* If we're not preserving permissions, change the file-list's
+        * mode based on the local permissions and some heuristics. */
+       if (!preserve_perms) {
+-              int exists = statret == 0 && !S_ISDIR(st.st_mode);
+-              file->mode = dest_mode(file->mode, st.st_mode, exists);
++              int exists = statret == 0 && !S_ISDIR(sx.st.st_mode);
++              file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
++                                     exists);
+       }
  #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
 -       && hard_link_check(file, ndx, fname, statret, &st, itemizing, code))
@@ -1830,7 +1829,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #endif
  
        if (preserve_links && S_ISLNK(file->mode)) {
-@@ -1242,28 +1297,28 @@ static void recv_generator(char *fname, 
+@@ -1244,28 +1299,28 @@ static void recv_generator(char *fname, 
                        char lnk[MAXPATHLEN];
                        int len;
  
@@ -1867,7 +1866,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, code);
                        if (j == -2) {
  #ifndef CAN_HARDLINK_SYMLINK
-@@ -1272,7 +1327,7 @@ static void recv_generator(char *fname, 
+@@ -1274,7 +1329,7 @@ static void recv_generator(char *fname, 
                                } else
  #endif
                                if (!copy_dest)
@@ -1876,7 +1875,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                itemizing = 0;
                                code = FNONE;
                        } else if (j >= 0)
-@@ -1280,7 +1335,7 @@ static void recv_generator(char *fname, 
+@@ -1282,7 +1337,7 @@ static void recv_generator(char *fname, 
                }
  #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && F_HLINK_NOT_LAST(file))
@@ -1885,7 +1884,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #endif
                if (do_symlink(sl, fname) != 0) {
                        rsyserr(FERROR, errno, "symlink %s -> \"%s\" failed",
-@@ -1288,7 +1343,7 @@ static void recv_generator(char *fname, 
+@@ -1290,7 +1345,7 @@ static void recv_generator(char *fname, 
                } else {
                        set_file_attrs(fname, file, NULL, 0);
                        if (itemizing) {
@@ -1894,7 +1893,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE, 0, NULL);
                        }
                        if (code != FNONE && verbose)
-@@ -1304,7 +1359,7 @@ static void recv_generator(char *fname, 
+@@ -1306,7 +1361,7 @@ static void recv_generator(char *fname, 
                                goto return_with_success;
                }
  #endif
@@ -1903,7 +1902,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if ((am_root && preserve_devices && IS_DEVICE(file->mode))
-@@ -1314,33 +1369,38 @@ static void recv_generator(char *fname, 
+@@ -1316,33 +1371,38 @@ static void recv_generator(char *fname, 
                if (statret == 0) {
                        char *t;
                        if (IS_DEVICE(file->mode)) {
@@ -1954,7 +1953,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, code);
                        if (j == -2) {
  #ifndef CAN_HARDLINK_SPECIAL
-@@ -1349,7 +1409,7 @@ static void recv_generator(char *fname, 
+@@ -1351,7 +1411,7 @@ static void recv_generator(char *fname, 
                                } else
  #endif
                                if (!copy_dest)
@@ -1963,7 +1962,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                itemizing = 0;
                                code = FNONE;
                        } else if (j >= 0)
-@@ -1357,7 +1417,7 @@ static void recv_generator(char *fname, 
+@@ -1359,7 +1419,7 @@ static void recv_generator(char *fname, 
                }
  #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && F_HLINK_NOT_LAST(file))
@@ -1972,7 +1971,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #endif
                if (verbose > 2) {
                        rprintf(FINFO, "mknod(%s, 0%o, [%ld,%ld])\n",
-@@ -1370,7 +1430,11 @@ static void recv_generator(char *fname, 
+@@ -1372,7 +1432,11 @@ static void recv_generator(char *fname, 
                } else {
                        set_file_attrs(fname, file, NULL, 0);
                        if (itemizing) {
@@ -1985,7 +1984,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE, 0, NULL);
                        }
                        if (code != FNONE && verbose)
-@@ -1382,14 +1446,14 @@ static void recv_generator(char *fname, 
+@@ -1384,14 +1448,14 @@ static void recv_generator(char *fname, 
                        if (remove_source_files == 1)
                                goto return_with_success;
                }
@@ -2002,7 +2001,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (max_size > 0 && F_LENGTH(file) > max_size) {
-@@ -1398,7 +1462,7 @@ static void recv_generator(char *fname, 
+@@ -1400,7 +1464,7 @@ static void recv_generator(char *fname, 
                                fname = f_name(file, NULL);
                        rprintf(FINFO, "%s is over max-size\n", fname);
                }
@@ -2011,7 +2010,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
        if (min_size > 0 && F_LENGTH(file) < min_size) {
                if (verbose > 1) {
-@@ -1406,39 +1470,39 @@ static void recv_generator(char *fname, 
+@@ -1408,39 +1472,39 @@ static void recv_generator(char *fname, 
                                fname = f_name(file, NULL);
                        rprintf(FINFO, "%s is under min-size\n", fname);
                }
@@ -2060,7 +2059,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (j >= 0) {
                        fnamecmp = fnamecmpbuf;
-@@ -1448,7 +1512,7 @@ static void recv_generator(char *fname, 
+@@ -1450,7 +1514,7 @@ static void recv_generator(char *fname, 
        }
  
        real_ret = statret;
@@ -2069,7 +2068,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
            && link_stat(partialptr, &partial_st, 0) == 0
-@@ -1467,7 +1531,7 @@ static void recv_generator(char *fname, 
+@@ -1469,7 +1533,7 @@ static void recv_generator(char *fname, 
                                rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
                                        fname, fnamecmpbuf);
                        }
@@ -2078,7 +2077,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        statret = 0;
                        fnamecmp = fnamecmpbuf;
                        fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1477,45 +1541,50 @@ static void recv_generator(char *fname, 
+@@ -1479,45 +1543,50 @@ static void recv_generator(char *fname, 
        if (statret != 0) {
  #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && F_HLINK_NOT_LAST(file))
@@ -2141,7 +2140,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                fnamecmp = partialptr;
                fnamecmp_type = FNAMECMP_PARTIAL_DIR;
                statret = 0;
-@@ -1540,16 +1609,20 @@ static void recv_generator(char *fname, 
+@@ -1542,16 +1611,20 @@ static void recv_generator(char *fname, 
                /* pretend the file didn't exist */
  #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && F_HLINK_NOT_LAST(file))
@@ -2164,7 +2163,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
                        close(fd);
-@@ -1560,7 +1633,7 @@ static void recv_generator(char *fname, 
+@@ -1562,7 +1635,7 @@ static void recv_generator(char *fname, 
                                full_fname(backupptr));
                        unmake_file(back_file);
                        close(fd);
@@ -2173,7 +2172,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if ((f_copy = do_open(backupptr,
                    O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1568,14 +1641,14 @@ static void recv_generator(char *fname, 
+@@ -1570,14 +1643,14 @@ static void recv_generator(char *fname, 
                                full_fname(backupptr));
                        unmake_file(back_file);
                        close(fd);
@@ -2190,7 +2189,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (verbose > 2)
-@@ -1599,26 +1672,34 @@ static void recv_generator(char *fname, 
+@@ -1601,26 +1674,34 @@ static void recv_generator(char *fname, 
                        iflags |= ITEM_BASIS_TYPE_FOLLOWS;
                if (fnamecmp_type == FNAMECMP_FUZZY)
                        iflags |= ITEM_XNAME_FOLLOWS;
@@ -2231,7 +2230,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (f_copy >= 0) {
                close(f_copy);
-@@ -1631,6 +1712,13 @@ static void recv_generator(char *fname, 
+@@ -1633,6 +1714,13 @@ static void recv_generator(char *fname, 
        }
  
        close(fd);
@@ -2245,7 +2244,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  }
  
  static void touch_up_dirs(struct file_list *flist, int ndx)
-@@ -1799,6 +1887,8 @@ void generate_files(int f_out, const cha
+@@ -1803,6 +1891,8 @@ void generate_files(int f_out, const cha
         * notice that and let us know via the redo pipe (or its closing). */
        ignore_timeout = 1;
  
@@ -2256,7 +2255,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        struct file_struct *fp = dir_flist->files[cur_flist->parent_ndx];
 --- old/hlink.c
 +++ new/hlink.c
-@@ -27,6 +27,7 @@ extern int verbose;
+@@ -26,6 +26,7 @@ extern int verbose;
  extern int dry_run;
  extern int do_xfers;
  extern int link_dest;
@@ -2264,7 +2263,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int make_backups;
  extern int protocol_version;
  extern int remove_source_files;
-@@ -268,15 +269,19 @@ void match_hard_links(void)
+@@ -267,15 +268,19 @@ void match_hard_links(void)
  }
  
  static int maybe_hard_link(struct file_struct *file, int ndx,
@@ -2288,7 +2287,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
                                        0, "");
                        }
-@@ -297,7 +302,11 @@ static int maybe_hard_link(struct file_s
+@@ -296,7 +301,11 @@ static int maybe_hard_link(struct file_s
  
        if (hard_link_one(file, fname, oldname, 0)) {
                if (itemizing) {
@@ -2301,7 +2300,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
                                realname);
                }
-@@ -311,7 +320,7 @@ static int maybe_hard_link(struct file_s
+@@ -310,7 +319,7 @@ static int maybe_hard_link(struct file_s
  /* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not.  Returns:
   * 0 = process the file, 1 = skip the file, -1 = error occurred. */
  int hard_link_check(struct file_struct *file, int ndx, const char *fname,
@@ -2310,7 +2309,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                    enum logcode code)
  {
        STRUCT_STAT prev_st;
-@@ -362,18 +371,20 @@ int hard_link_check(struct file_struct *
+@@ -361,18 +370,20 @@ int hard_link_check(struct file_struct *
        if (statret < 0 && basis_dir[0] != NULL) {
                /* If we match an alt-dest item, we don't output this as a change. */
                char cmpbuf[MAXPATHLEN];
@@ -2336,7 +2335,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                if (verbose < 2 || !stdout_format_has_i) {
                                        itemizing = 0;
                                        code = FNONE;
-@@ -382,16 +393,36 @@ int hard_link_check(struct file_struct *
+@@ -381,16 +392,36 @@ int hard_link_check(struct file_struct *
                                }
                                break;
                        }
@@ -2377,7 +2376,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                            realname, itemizing, code) < 0)
                return -1;
  
-@@ -426,7 +457,8 @@ void finish_hard_link(struct file_struct
+@@ -425,7 +456,8 @@ void finish_hard_link(struct file_struct
                      STRUCT_STAT *stp, int itemizing, enum logcode code,
                      int alt_dest)
  {
@@ -2387,7 +2386,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char alt_name[MAXPATHLEN], *prev_name;
        const char *our_name;
        int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
-@@ -450,14 +482,24 @@ void finish_hard_link(struct file_struct
+@@ -449,14 +481,24 @@ void finish_hard_link(struct file_struct
        } else
                our_name = fname;
  
@@ -5714,7 +5713,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +#endif /* SUPPORT_ACLS */
 --- old/log.c
 +++ new/log.c
-@@ -625,8 +625,10 @@ static void log_formatted(enum logcode c
+@@ -624,8 +624,10 @@ static void log_formatted(enum logcode c
                        c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
                        c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
                        c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
@@ -5729,7 +5728,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                char ch = iflags & ITEM_IS_NEW ? '+' : '?';
 --- old/options.c
 +++ new/options.c
-@@ -47,6 +47,7 @@ int copy_dirlinks = 0;
+@@ -46,6 +46,7 @@ int copy_dirlinks = 0;
  int copy_links = 0;
  int preserve_links = 0;
  int preserve_hard_links = 0;
@@ -5737,7 +5736,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  int preserve_perms = 0;
  int preserve_executability = 0;
  int preserve_devices = 0;
-@@ -199,6 +200,7 @@ static void print_rsync_version(enum log
+@@ -198,6 +199,7 @@ static void print_rsync_version(enum log
        char const *got_socketpair = "no ";
        char const *have_inplace = "no ";
        char const *hardlinks = "no ";
@@ -5745,7 +5744,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char const *links = "no ";
        char const *ipv6 = "no ";
        STRUCT_STAT *dumstat;
-@@ -215,6 +217,10 @@ static void print_rsync_version(enum log
+@@ -214,6 +216,10 @@ static void print_rsync_version(enum log
        hardlinks = "";
  #endif
  
@@ -5756,7 +5755,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #ifdef SUPPORT_LINKS
        links = "";
  #endif
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+@@ -232,8 +238,8 @@ static void print_rsync_version(enum log
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -5767,7 +5766,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -280,7 +286,7 @@ void usage(enum logcode F)
+@@ -279,7 +285,7 @@ void usage(enum logcode F)
    rprintf(F," -q, --quiet                 suppress non-error messages\n");
    rprintf(F,"     --no-motd               suppress daemon-mode MOTD (see manpage caveat)\n");
    rprintf(F," -c, --checksum              skip based on checksum, not mod-time & size\n");
@@ -5776,7 +5775,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    rprintf(F,"     --no-OPTION             turn off an implied OPTION (e.g. --no-D)\n");
    rprintf(F," -r, --recursive             recurse into directories\n");
    rprintf(F," -R, --relative              use relative path names\n");
-@@ -302,6 +308,9 @@ void usage(enum logcode F)
+@@ -301,6 +307,9 @@ void usage(enum logcode F)
    rprintf(F," -p, --perms                 preserve permissions\n");
    rprintf(F," -E, --executability         preserve the file's executability\n");
    rprintf(F,"     --chmod=CHMOD           affect file and/or directory permissions\n");
@@ -5786,7 +5785,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
    rprintf(F," -g, --group                 preserve group\n");
    rprintf(F,"     --devices               preserve device files (super-user only)\n");
-@@ -422,6 +431,9 @@ static struct poptOption long_options[] 
+@@ -421,6 +430,9 @@ static struct poptOption long_options[] 
    {"no-perms",         0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
    {"no-p",             0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
    {"executability",   'E', POPT_ARG_NONE,   &preserve_executability, 0, 0, 0 },
@@ -5796,7 +5795,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 1, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
-@@ -1093,6 +1105,24 @@ int parse_arguments(int *argc, const cha
+@@ -1092,6 +1104,24 @@ int parse_arguments(int *argc, const cha
                        usage(FINFO);
                        exit_cleanup(0);
  
@@ -5821,7 +5820,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -1556,6 +1586,10 @@ void server_options(char **args,int *arg
+@@ -1555,6 +1585,10 @@ void server_options(char **args,int *arg
                argstr[x++] = 'p';
        else if (preserve_executability && am_sender)
                argstr[x++] = 'E';
@@ -5834,7 +5833,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (always_checksum)
 --- old/receiver.c
 +++ new/receiver.c
-@@ -48,6 +48,7 @@ extern int keep_partial;
+@@ -47,6 +47,7 @@ extern int keep_partial;
  extern int checksum_seed;
  extern int inplace;
  extern int delay_updates;
@@ -5842,7 +5841,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern struct stats stats;
  extern char *tmpdir;
  extern char *partial_dir;
-@@ -348,6 +349,10 @@ int recv_files(int f_in, char *local_nam
+@@ -347,6 +348,10 @@ int recv_files(int f_in, char *local_nam
        int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
        enum logcode log_code = log_before_transfer ? FLOG : FINFO;
        int max_phase = protocol_version >= 29 ? 2 : 1;
@@ -5853,7 +5852,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        int ndx, recv_ok;
  
        if (verbose > 2)
-@@ -563,7 +568,16 @@ int recv_files(int f_in, char *local_nam
+@@ -562,7 +567,16 @@ int recv_files(int f_in, char *local_nam
                 * mode based on the local permissions and some heuristics. */
                if (!preserve_perms) {
                        int exists = fd1 != -1;
@@ -5873,7 +5872,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                /* We now check to see if we are writing the file "inplace" */
 --- old/rsync.c
 +++ new/rsync.c
-@@ -32,6 +32,7 @@
+@@ -31,6 +31,7 @@
  
  extern int verbose;
  extern int dry_run;
@@ -5881,7 +5880,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_perms;
  extern int preserve_executability;
  extern int preserve_times;
-@@ -50,7 +51,6 @@ extern int inplace;
+@@ -49,7 +50,6 @@ extern int inplace;
  extern int flist_eof;
  extern int keep_dirlinks;
  extern int make_backups;
@@ -5889,7 +5888,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  extern struct chmod_mode_struct *daemon_chmod_modes;
  
-@@ -202,7 +202,8 @@ void free_sums(struct sum_struct *s)
+@@ -203,7 +203,8 @@ void free_sums(struct sum_struct *s)
  
  /* This is only called when we aren't preserving permissions.  Figure out what
   * the permissions should be and return them merged back into the mode. */
@@ -5899,7 +5898,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  {
        int new_mode;
        /* If the file already exists, we'll return the local permissions,
-@@ -219,56 +220,65 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -220,56 +221,65 @@ mode_t dest_mode(mode_t flist_mode, mode
                                new_mode |= (new_mode & 0444) >> 2;
                }
        } else {
@@ -5980,7 +5979,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                ;
        else
  #endif
-@@ -278,45 +288,57 @@ int set_file_attrs(char *fname, struct f
+@@ -279,45 +289,57 @@ int set_file_attrs(char *fname, struct f
                                rprintf(FINFO,
                                        "set uid of %s from %ld to %ld\n",
                                        fname,
@@ -6048,7 +6047,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (ret == 0) /* ret == 1 if symlink could not be set */
                        updated = 1;
-@@ -329,6 +351,11 @@ int set_file_attrs(char *fname, struct f
+@@ -330,6 +352,11 @@ int set_file_attrs(char *fname, struct f
                else
                        rprintf(FCLIENT, "%s is uptodate\n", fname);
        }
@@ -6062,7 +6061,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/rsync.h
 +++ new/rsync.h
-@@ -546,6 +546,14 @@ struct idev_node {
+@@ -547,6 +547,14 @@ struct idev_node {
  #define IN_LOOPBACKNET 127
  #endif
  
@@ -6077,7 +6076,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #define GID_NONE ((gid_t)-1)
  
  union file_extras {
-@@ -565,6 +573,7 @@ struct file_struct {
+@@ -566,6 +574,7 @@ struct file_struct {
  extern int file_extra_cnt;
  extern int preserve_uid;
  extern int preserve_gid;
@@ -6085,7 +6084,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
  #define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
  #define EXTRA_LEN (sizeof (union file_extras))
-@@ -597,10 +606,12 @@ extern int preserve_gid;
+@@ -598,10 +607,12 @@ extern int preserve_gid;
  /* When the associated option is on, all entries will have these present: */
  #define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
  #define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
@@ -6098,7 +6097,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #define F_DIRDEV_P(f) (&OPT_EXTRA(f, LEN64_BUMP(f) + 2 - 1)->unum)
  #define F_DIRNODE_P(f) (&OPT_EXTRA(f, LEN64_BUMP(f) + 3 - 1)->num)
  
-@@ -752,6 +763,17 @@ struct stats {
+@@ -753,6 +764,17 @@ struct stats {
  
  struct chmod_mode_struct;
  
@@ -6116,7 +6115,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #include "byteorder.h"
  #include "lib/mdfour.h"
  #include "lib/wildmatch.h"
-@@ -770,6 +792,16 @@ struct chmod_mode_struct;
+@@ -771,6 +793,16 @@ struct chmod_mode_struct;
  #define NORETURN __attribute__((__noreturn__))
  #endif
  
@@ -6869,7 +6868,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/uidlist.c
 +++ new/uidlist.c
-@@ -36,6 +36,7 @@ extern int verbose;
+@@ -35,6 +35,7 @@ extern int verbose;
  extern int am_root;
  extern int preserve_uid;
  extern int preserve_gid;
@@ -6877,7 +6876,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int numeric_ids;
  
  struct idlist {
-@@ -272,7 +273,7 @@ void send_uid_list(int f)
+@@ -271,7 +272,7 @@ void send_uid_list(int f)
  {
        struct idlist *list;
  
@@ -6886,7 +6885,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                int len;
                /* we send sequences of uid/byte-length/name */
                for (list = uidlist; list; list = list->next) {
-@@ -289,7 +290,7 @@ void send_uid_list(int f)
+@@ -288,7 +289,7 @@ void send_uid_list(int f)
                write_int(f, 0);
        }
  
@@ -6895,7 +6894,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                int len;
                for (list = gidlist; list; list = list->next) {
                        if (!list->name)
-@@ -329,18 +330,28 @@ void recv_uid_list(int f, struct file_li
+@@ -328,18 +329,28 @@ void recv_uid_list(int f, struct file_li
  {
        int id, i;
  
@@ -6928,7 +6927,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                for (i = 0; i < flist->count; i++)
 --- old/util.c
 +++ new/util.c
-@@ -1467,3 +1467,31 @@ int bitbag_next_bit(struct bitbag *bb, i
+@@ -1466,3 +1466,31 @@ int bitbag_next_bit(struct bitbag *bb, i
  
        return -1;
  }
index 90e7ad6..61d8f50 100644 (file)
@@ -9,7 +9,7 @@ To use this patch, run these commands for a successful build:
 
 --- old/generator.c
 +++ new/generator.c
-@@ -45,6 +45,7 @@ extern int preserve_uid;
+@@ -44,6 +44,7 @@ extern int preserve_uid;
  extern int preserve_gid;
  extern int preserve_times;
  extern int omit_dir_times;
@@ -17,7 +17,7 @@ To use this patch, run these commands for a successful build:
  extern int delete_mode;
  extern int delete_before;
  extern int delete_during;
-@@ -541,10 +542,11 @@ void itemize(struct file_struct *file, i
+@@ -543,10 +544,11 @@ void itemize(struct file_struct *file, i
                        iflags |= ITEM_REPORT_TIME;
                if (!BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS))
                        iflags |= ITEM_REPORT_PERMS;
@@ -32,18 +32,18 @@ To use this patch, run these commands for a successful build:
                        iflags |= ITEM_REPORT_GROUP;
        } else
                iflags |= ITEM_IS_NEW;
-@@ -1161,7 +1163,7 @@ static void recv_generator(char *fname, 
+@@ -1216,7 +1218,7 @@ static void recv_generator(char *fname, 
  
        /* If we're not preserving permissions, change the file-list's
         * mode based on the local permissions and some heuristics. */
 -      if (!preserve_perms) {
 +      if (!preserve_perms || (omit_dir_changes && S_ISDIR(st.st_mode))) {
-               int exists = statret == 0
-                         && S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
+               int exists = statret == 0 && !S_ISDIR(st.st_mode);
                file->mode = dest_mode(file->mode, st.st_mode, exists);
+       }
 --- old/options.c
 +++ new/options.c
-@@ -55,6 +55,7 @@ int preserve_uid = 0;
+@@ -54,6 +54,7 @@ int preserve_uid = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
  int omit_dir_times = 0;
@@ -51,7 +51,7 @@ To use this patch, run these commands for a successful build:
  int update_only = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
-@@ -309,6 +310,7 @@ void usage(enum logcode F)
+@@ -308,6 +309,7 @@ void usage(enum logcode F)
    rprintf(F," -D                          same as --devices --specials\n");
    rprintf(F," -t, --times                 preserve times\n");
    rprintf(F," -O, --omit-dir-times        omit directories when preserving times\n");
@@ -59,7 +59,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --super                 receiver attempts super-user activities\n");
    rprintf(F," -S, --sparse                handle sparse files efficiently\n");
    rprintf(F," -n, --dry-run               show what would have been transferred\n");
-@@ -426,6 +428,7 @@ static struct poptOption long_options[] 
+@@ -425,6 +427,7 @@ static struct poptOption long_options[] 
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"omit-dir-times",  'O', POPT_ARG_VAL,    &omit_dir_times, 2, 0, 0 },
@@ -67,7 +67,7 @@ To use this patch, run these commands for a successful build:
    {"modify-window",    0,  POPT_ARG_INT,    &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
    {"super",            0,  POPT_ARG_VAL,    &am_root, 2, 0, 0 },
    {"no-super",         0,  POPT_ARG_VAL,    &am_root, 0, 0, 0 },
-@@ -1293,6 +1296,9 @@ int parse_arguments(int *argc, const cha
+@@ -1292,6 +1295,9 @@ int parse_arguments(int *argc, const cha
                        "P *%s", backup_suffix);
                parse_rule(&filter_list, backup_dir_buf, 0, 0);
        }
@@ -77,7 +77,7 @@ To use this patch, run these commands for a successful build:
        if (make_backups && !backup_dir)
                omit_dir_times = 1;
  
-@@ -1526,6 +1532,8 @@ void server_options(char **args,int *arg
+@@ -1525,6 +1531,8 @@ void server_options(char **args,int *arg
                        argstr[x++] = 'm';
                if (omit_dir_times == 2)
                        argstr[x++] = 'O';
@@ -88,7 +88,7 @@ To use this patch, run these commands for a successful build:
                        argstr[x++] = 'L';
 --- old/receiver.c
 +++ new/receiver.c
-@@ -38,6 +38,7 @@ extern int protocol_version;
+@@ -37,6 +37,7 @@ extern int protocol_version;
  extern int relative_paths;
  extern int preserve_hard_links;
  extern int preserve_perms;
@@ -107,7 +107,7 @@ To use this patch, run these commands for a successful build:
                }
 --- old/rsync.c
 +++ new/rsync.c
-@@ -36,6 +36,7 @@ extern int preserve_perms;
+@@ -35,6 +35,7 @@ extern int preserve_perms;
  extern int preserve_executability;
  extern int preserve_times;
  extern int omit_dir_times;