Michael Paquier <mich...@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