Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99382f4

Browse files
committed
Save and restore errno across bindtextdomain call, per discussion.
1 parent3d6b0d8 commit99382f4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/interfaces/libpq/fe-misc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1994, Regents of the University of California
2424
*
2525
* IDENTIFICATION
26-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.114 2005/06/12 00:00:21 neilc Exp $
26+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.115 2005/07/06 16:25:59 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -1128,13 +1128,21 @@ PQenv2encoding(void)
11281128
char*
11291129
libpq_gettext(constchar*msgid)
11301130
{
1131-
staticintalready_bound=0;
1131+
staticboolalready_bound=false;
11321132

11331133
if (!already_bound)
11341134
{
1135-
already_bound=1;
1135+
/* dgettext() preserves errno, but bindtextdomain() doesn't */
1136+
intsave_errno=errno;
1137+
constchar*ldir;
1138+
1139+
already_bound= true;
11361140
/* No relocatable lookup here because the binary could be anywhere */
1137-
bindtextdomain("libpq",getenv("PGLOCALEDIR") ?getenv("PGLOCALEDIR") :LOCALEDIR);
1141+
ldir=getenv("PGLOCALEDIR");
1142+
if (!ldir)
1143+
ldir=LOCALEDIR;
1144+
bindtextdomain("libpq",ldir);
1145+
errno=save_errno;
11381146
}
11391147

11401148
returndgettext("libpq",msgid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp