X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/18979194cfd4b245f6d29064617257dd312ed683..eefe189e1d8a7919d3b69a8db6dede3cf7f8c250:/generator.c?ds=sidebyside diff --git a/generator.c b/generator.c index 1f36c5d9..55f0e4a5 100644 --- a/generator.c +++ b/generator.c @@ -520,8 +520,7 @@ static void do_delete_pass(struct file_list *flist) int unchanged_attrs(struct file_struct *file, STRUCT_STAT *st) { - if (preserve_perms - && (unsigned)(st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) + if (preserve_perms && !BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS)) return 0; if (am_root && preserve_uid && st->st_uid != F_UID(file)) @@ -548,7 +547,7 @@ void itemize(struct file_struct *file, int ndx, int statret, STRUCT_STAT *st, && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname)) || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0)) iflags |= ITEM_REPORT_TIME; - if ((unsigned)(st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) + if (!BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS)) iflags |= ITEM_REPORT_PERMS; if (preserve_uid && am_root && F_UID(file) != st->st_uid) iflags |= ITEM_REPORT_OWNER; @@ -1239,7 +1238,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_FIRST(file) + if (preserve_hard_links && F_HLINK_NOT_FIRST(file) && hard_link_check(file, ndx, fname, statret, &st, itemizing, code)) return; #endif @@ -1298,7 +1297,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = 1; } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (do_symlink(sl, fname) != 0) { @@ -1342,7 +1341,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, t = "special file"; } if (statret == 0 - && (unsigned)(st.st_mode & ~CHMOD_BITS) == (file->mode & ~CHMOD_BITS) + && BITS_EQUAL(st.st_mode, file->mode, _S_IFMT) && st.st_rdev == rdev) { /* The device or special file is identical. */ if (itemizing) @@ -1375,7 +1374,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = 1; } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (verbose > 2) { @@ -1495,7 +1494,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (statret != 0) { #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (stat_errno == ENOENT) @@ -1517,10 +1516,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, do_unlink(partialptr); handle_partial_dir(partialptr, PDIR_DELETE); } - if (itemizing) { - itemize(file, ndx, statret, &st, - 0, 0, NULL); - } + if (itemizing) + itemize(file, ndx, statret, &st, 0, 0, NULL); set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT); #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && F_IS_HLINKED(file)) @@ -1560,7 +1557,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, pretend_missing: /* pretend the file didn't exist */ #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif statret = real_ret = -1;