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))
&& (!(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;
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)
if (daemon_chmod_modes && !S_ISLNK(new_mode))
new_mode = tweak_mode(new_mode, daemon_chmod_modes);
#ifdef HAVE_CHMOD
- if ((st->st_mode & CHMOD_BITS) != (new_mode & CHMOD_BITS)) {
+ if (!BITS_EQUAL(st->st_mode, new_mode, CHMOD_BITS)) {
int ret = do_chmod(fname, new_mode);
if (ret < 0) {
rsyserr(FERROR, errno,