Do not get error code from ferror(), only error status.

ferror() only returns true or false. errno must still be used to get
the actual error code.

Fixes issue 2475.