Re: Error handling fix in interfaces/libpq/fe-secure.c - Mailing list pgsql-patches

From Tom Lane
Subject Re: Error handling fix in interfaces/libpq/fe-secure.c
Date
Msg-id 25699.1120658138@sss.pgh.pa.us
Whole thread Raw
In response to Re: Error handling fix in interfaces/libpq/fe-secure.c  (jtv@xs4all.nl)
List pgsql-patches
jtv@xs4all.nl writes:
> Tom Lane wrote:
>> The gettext function does not modify the value of the global errno
>> variable. This is necessary to make it possible to write something like
>>
>> printf (gettext ("Operation failed: %m\n"));
>>
>> which is pretty much what I expected to find.  Ergo, this entire
>> discussion is wrong, and whatever bug you are concerned about will
>> not be solved this way.

> Tom, I didn't know that gettext() preserved errno--but I still believe
> you're wrong.  The problem is not gettext() but libpq_gettext().  The
> latter calls the former, but it may go through initialization first--which
> would still pollute errno on the first call.

Good point --- we should make it save and restore errno around the
bindtextdomain() call.  Will do.

            regards, tom lane

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: patch: garbage error strings in libpq
Next
From: Tom Lane
Date:
Subject: Re: patch: garbage error strings in libpq