}
if (link_dest) {
if (preserve_perms
- && (st->st_mode & ~_S_IFMT) != (file->mode & ~_S_IFMT))
+ && (st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS))
return 0;
if (am_root && preserve_uid && st->st_uid != file->uid)
/* if the file exists already and we aren't perserving
* permissions then act as though the remote end sent
* us the file permissions we already have */
- file->mode = (file->mode & _S_IFMT) | (st.st_mode & ~_S_IFMT);
+ file->mode = (file->mode & ~CHMOD_BITS)
+ | (st.st_mode & CHMOD_BITS);
}
if (S_ISDIR(file->mode)) {