Re: Why PG_SETMASK() change errno to 0 when there is an elog() call before or after it? Is it a bug?

From: Andres Freund <andres(at)anarazel(dot)de>
To: CNG L <congnanluo(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Why PG_SETMASK() change errno to 0 when there is an elog() call before or after it? Is it a bug?
Date: 2019-01-28 04:50:34
Message-ID: 20190128045034.f76oyyjim33t64mh@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2019-01-27 18:21:11 -0800, CNG L wrote:
> In founction ServerLoop() in code postmaster.c, after select(), we called
> PG_SETMASK(). If l add an elog() after PG_SETMASK(), I see errno is reset
> to 0 when PG_SETMASK() call suceeded. But the immediately code will
> actually check errno from the select() call which now has been overwritten
> by PG_SETMASK().

Yes, hat's a bug, we need to restore errno after the setmask. I think I
broke that a few years back, in a39e78b710eb588e102aedd2828611d7bc74714b.
I'll try to fix that later this week - I'm flying to Brussels Tuesday
morning, not sure I can get this done before.

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-01-28 06:45:45 Re: BUG #15548: Unaccent does not remove combining diacritical characters
Previous Message 钱学斌 2019-01-28 02:28:46 pgsql bug