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.
Merge pull request #556 from kacfengine/issue-2475

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