Re: Errands around AllocateDir()

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Errands around AllocateDir()
Date: 2017-12-05 01:29:21
Message-ID: CAB7nPqR+0BJ3qgWkz9DnOhtZ8VLzUrnVCS5Aa8ubdK+YAFL5DA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 5, 2017 at 7:17 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> I had a close look at all the callers of AllocateDir() and noticed a
>> couple of unwelcome things (Tom noticed some of those in the thread
>> mentioned above, I found others):
>
> Pushed with some minor additional fiddling.

Thanks.

> The most notable thing I changed was that instead of this:
>
>> - perform_base_backup() makes the mistake of not saving errno before
>> CheckXLogRemoved() when AllocateDir returns NULL, which can lead to an
>> incorrect error message.
>
> I modified CheckXLogRemoved() to internally guarantee that it does not
> change errno. This is because there seemed to be other call sites that
> were depending on that, not just this one. Anyway, that seemed like a
> more future-proof fix than relying on callers to deal with it.

Hm, OK. Yes I can see the point behind this way of doing instead,
CheckXLogRemoved() is much used in error code paths.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-12-05 01:34:00 Re: Errands around AllocateDir()
Previous Message Thomas Munro 2017-12-05 01:15:19 Re: es_query_dsa is broken