Use stat call as fallback when searching directory

If readdir returns a type DT_UNKNOWN a stat call is made
in order to determine if the node is a directory.