Fix incorrect usage of S_IFDIR flag
Merge pull request #5386 from Karlson2k/fix_s_ifdir_01

Fix incorrect usage of S_IFDIR flag