The match_gid() function needed to affect the *flags_ptr value
[rsync/rsync.git] / generator.c
index f6167df..05022cf 100644 (file)
@@ -521,10 +521,10 @@ int unchanged_attrs(const char *fname, struct file_struct *file, statx *sxp)
        if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                return 0;
 
-       if (am_root && preserve_uid && sxp->st.st_uid != F_UID(file))
+       if (am_root && preserve_uid && sxp->st.st_uid != (uid_t)F_OWNER(file))
                return 0;
 
-       if (preserve_gid && F_GID(file) != GID_NONE && sxp->st.st_gid != F_GID(file))
+       if (preserve_gid && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
                return 0;
 
 #ifdef SUPPORT_ACLS
@@ -565,10 +565,10 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
                        iflags |= ITEM_REPORT_TIME;
                if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                        iflags |= ITEM_REPORT_PERMS;
-               if (preserve_uid && am_root && F_UID(file) != sxp->st.st_uid)
+               if (preserve_uid && am_root && (uid_t)F_OWNER(file) != sxp->st.st_uid)
                        iflags |= ITEM_REPORT_OWNER;
-               if (preserve_gid && F_GID(file) != GID_NONE
-                   && sxp->st.st_gid != F_GID(file))
+               if (preserve_gid && !(file->flags & FLAG_SKIP_GROUP)
+                   && sxp->st.st_gid != (gid_t)F_GROUP(file))
                        iflags |= ITEM_REPORT_GROUP;
 #ifdef SUPPORT_ACLS
                if (preserve_acls && !S_ISLNK(file->mode)) {
@@ -1733,7 +1733,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
        /* Fix any directory permissions that were modified during the
         * transfer and/or re-set any tweaked modified-time values. */
        for (i = start, j = 0; i <= end; i++) {
-               file = flist->sorted[i];
+               file = flist->files[i];
                if (!F_IS_ACTIVE(file) || !S_ISDIR(file->mode)
                 || file->flags & FLAG_MISSING_DIR)
                        continue;
@@ -2008,7 +2008,7 @@ void generate_files(int f_out, const char *local_name)
 
        if ((need_retouch_dir_perms || need_retouch_dir_times)
         && dir_tweaking && (!inc_recurse || delete_during == 2))
-               touch_up_dirs(inc_recurse ? dir_flist : cur_flist, -1);
+               touch_up_dirs(dir_flist, -1);
 
        if (max_delete >= 0 && deletion_count > max_delete) {
                rprintf(FINFO,