io: handle fread() errors

When, occasionally, trying to read directory instead of file, `fread()`
returns `EISDIR` error. And, considering, absence of error handling,
`read_whole_stream()` just loops indefinitely.
auto merge of #6311 : indutny/rust/fix/handle-io-fread-errors, r=z0w0

When, occasionally, trying to read directory instead of file, `fread()`
returns `EISDIR` error. And, considering, absence of error handling,
`read_whole_stream()` just loops indefinitely.