Re: patch: garbage error strings in libpq - Mailing list pgsql-patches

From Tom Lane
Subject Re: patch: garbage error strings in libpq
Date
Msg-id 12996.1120574333@sss.pgh.pa.us
Whole thread Raw
In response to patch: garbage error strings in libpq  (jtv@xs4all.nl)
Responses Re: patch: garbage error strings in libpq
List pgsql-patches
jtv@xs4all.nl writes:
> Another approach would have been to make libpq_gettext() preserve errno.

That seems like a far easier, cleaner, and more robust fix than this.

Moreover I don't believe that this approach works either, as the result
of strerror() is not guaranteed still usable after another strerror call
(ie, it can use a static buffer repeatedly), so you'd still have the
problem if libpq_gettext invokes strerror.  I suppose that a really
robust solution would involve libpq_gettext saving errno, restoring
errno, and invoking strerror() again ...

            regards, tom lane

pgsql-patches by date:

Previous
From: Michael Fuhr
Date:
Subject: pgcrypto volatility and strictness changes
Next
From: Tom Lane
Date:
Subject: Re: Error handling fix in interfaces/libpq/fe-secure.c