Separate the dirs from the files in xattrs.text.
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index 938969a..17ce76a 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -368,7 +368,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
        /* Support the protocol-29 keep-alive style. */
        if (protocol_version < 30 && ndx == cur_flist->used && iflags == ITEM_IS_NEW) {
                if (am_sender)
-                       maybe_send_keepalive(time(NULL), True);
+                       maybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH);
                goto read_loop;
        }
 
@@ -489,7 +489,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
                set_xattr(fname, file, fnamecmp, sxp);
 #endif
 
-       if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && preserve_times == 1))
+       if (!preserve_times
+        || (!(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;
        if (!(flags & ATTRS_SKIP_MTIME)
            && cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
@@ -508,7 +510,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
        change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
        change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
                  && sxp->st.st_gid != (gid_t)F_GROUP(file);
-#if !defined HAVE_LCHOWN && !defined CHOWN_MODIFIES_SYMLINK
+#ifndef CAN_CHOWN_SYMLINK
        if (S_ISLNK(sxp->st.st_mode)) {
                ;
        } else
@@ -644,15 +646,13 @@ int finish_transfer(const char *fname, const char *fnametmp,
        /* move tmp file over real file */
        if (DEBUG_GTE(RECV, 1))
                rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
-       ret = robust_rename(fnametmp, fname, temp_copy_name,
-                           file->mode & INITACCESSPERMS);
+       ret = robust_rename(fnametmp, fname, temp_copy_name, file->mode);
        if (ret < 0) {
                rsyserr(FERROR_XFER, errno, "%s %s -> \"%s\"",
                        ret == -2 ? "copy" : "rename",
                        full_fname(fnametmp), fname);
                if (!partialptr || (ret == -2 && temp_copy_name)
-                || robust_rename(fnametmp, partialptr, NULL,
-                                 file->mode & INITACCESSPERMS) < 0)
+                || robust_rename(fnametmp, partialptr, NULL, file->mode) < 0)
                        do_unlink(fnametmp);
                return 0;
        }