Re: pgsql: Address set of issues with errno handling - Mailing list pgsql-committers

From Michael Paquier
Subject Re: pgsql: Address set of issues with errno handling
Date
Msg-id 20180804121834.GG20967@paquier.xyz
Whole thread Raw
In response to Re: pgsql: Address set of issues with errno handling  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Address set of issues with errno handling  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
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

Attachment

pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: Make "kerberos" test suite independent of "localhost" nameresol
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Address set of issues with errno handling