postgres.git / summary / log / commit / refs
commit a5d10d66d1c8768974ae6245bdff8f28e0dab31f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri Jul 08 15:25:19 2005 +0000
First released in: 8.1.0, 7.3.11, 7.4.9, 8.0.4
Make libpq_gettext save and restore errno in a Windows-compatible way.
Also, back-patch fix into back branches.
src/interfaces/libpq/fe-misc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 4349a4e05aa..0f3f2813711 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.103 2003/10/19 21:36:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.103.2.1 2005/07/08 15:25:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1120,8 +1120,16 @@ libpq_gettext(const char *msgid)
if (!already_bound)
{
+ /* dgettext() preserves errno, but bindtextdomain() doesn't */
+ int save_errno = errno;
+
already_bound = 1;
bindtextdomain("libpq", LOCALEDIR);
+#ifdef WIN32
+ SetLastError(save_errno);
+#else
+ errno = save_errno;
+#endif
}
return dgettext("libpq", msgid);
[parent: 4677334cedf5]