1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-18 17:41:14 +03:00

Make libpq_gettext save and restore errno in a Windows-compatible way.

Also, back-patch fix into back branches.
This commit is contained in:
Tom Lane 2005-07-08 15:25:19 +00:00
parent 4677334ced
commit a5d10d66d1

View File

@ -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);