Trying to Read from a directory results in an error code, but we also missed that because an unsigned variable was used to store the result. Fixes #10210.