Re: pg_logging_init() can return ENOTTY with TAP tests - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_logging_init() can return ENOTTY with TAP tests
Date
Msg-id 604591.1600480482@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_logging_init() can return ENOTTY with TAP tests  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pg_logging_init() can return ENOTTY with TAP tests  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Fri, Sep 18, 2020 at 09:56:14AM -0400, Tom Lane wrote:
>> No, this is a bad idea.  The right place to fix this is whatever code
>> segment is relying on errno to be initially zero; that is NEVER a sane
>> assumption.  That is, a valid coding pattern is something like

> So for now, what about looking at all those code paths and enforce
> errno to 0?

No, absolutely not.  That way leads to madness, because you will be trying
to enforce a system-wide property for the benefit of a few places.  There
is *no code anywhere* that promises to leave errno zero, but what you are
suggesting will soon lead to a situation where we have to require that of
everything.  It's not sane, it's not maintainable, and it's going to be
inefficient as heck, because it will require adding a whole lot more
"errno = 0" statements than the other way.

            regards, tom lane



> --
> Michael



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_logging_init() can return ENOTTY with TAP tests
Next
From: Michael Paquier
Date:
Subject: Re: OpenSSL 3.0.0 compatibility