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

Simple fix.  Don't know if it works on all our platforms.