Redmine#4791: mask out S_IFMT (file types) from body perms mode as per POSIX 2001
Merge pull request #1523 from tzz/feature/redmine4791-and-body-perms-mode-S_IFMT

Redmine#4791: AND body perms mode with S_IFMT as per POSIX 2001