Re: pgsql: Address set of issues with errno handling

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Address set of issues with errno handling
Date: 2018-08-04 12:18:34
Message-ID: 20180804121834.GG20967@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
errno-write-init.patch text/x-diff 5.0 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-08-04 15:21:28 Re: pgsql: Address set of issues with errno handling
Previous Message Noah Misch 2018-08-04 04:01:59 pgsql: Make "kerberos" test suite independent of "localhost" name resol