Re: [PATCH V2] Fix return value from fstat calls

NeilBrown
2021-08-13T07:19:16Z

On Fri, 13 Aug 2021, Tkaczyk, Mariusz wrote:
>
> Maybe It won't be useful for users but it may help developers to avoid
> trivial mistakes. As you told, if everything is fine then check is dead.
> In my opinion any error handling is better than nothing.

Error handling that is buggy, or that is hard to maintain is not better
than nothing. If I can't guarantee that we never pass a bad file
descriptor, then you cannot guarantee that the error handling has no
bugs. Less code generally means less bugs.

Any attempt to try to handle an error that should not be able to happen
other than crashing is fairly pointless - you cannot guess the real
cause, so you cannot know how to repair. Just printing a message and
continuing could be as bad as not checking the error.

NeilBrown