On Fri, Aug 03, 2018 at 04:04:36PM -0400, Tom Lane wrote:
> That's not good enough, because there is no reason to suppose that errno
> is initially zero; in reality it'll be whatever was left over from the
> last failed syscall, perhaps far distant from here. The places that do
> this correctly do it like so:
>
> [... code ...]
Yes, I have visibly assumed that the last syscall was already failing
so those conditions would not be hit. If the code gets changed again
that would be a problem.
> You need to go back and add the pre-clearing of errno in each of these
> places, otherwise the added code is basically useless.
I looked at all code paths enforcing ENOSPC on write() calls, and
attached is a patch to address this issue for all of them. What do you
think? I can of course get that addressed before the next set of minor
releases.
--
Michael