Re: Error handling fix in interfaces/libpq/fe-secure.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jtv(at)xs4all(dot)nl
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Error handling fix in interfaces/libpq/fe-secure.c
Date: 2005-07-06 13:55:38
Message-ID: 25699.1120658138@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

jtv(at)xs4all(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-07-06 13:59:03 Re: patch: garbage error strings in libpq
Previous Message Neil Conway 2005-07-06 12:37:04 Re: patch: garbage error strings in libpq