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

Commitfcd4575

Browse files
committed
Fix untranslatable assembly of libpq connection failure message
Even though this only affects the insertion of a parenthesized word,it's unwise to assume that parentheses can pass through untranslated.And in any case, the new version is clearer in the code and fortranslators.
1 parent8d89549 commitfcd4575

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

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

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ connectFailureMessage(PGconn *conn, int errorno)
10121012
#endif/* HAVE_UNIX_SOCKETS */
10131013
{
10141014
charhost_addr[NI_MAXHOST];
1015-
booldisplay_host_addr;
1015+
constchar*displayed_host;
10161016
structsockaddr_storage*addr=&conn->raddr.addr;
10171017

10181018
/*
@@ -1042,30 +1042,36 @@ connectFailureMessage(PGconn *conn, int errorno)
10421042
else
10431043
strcpy(host_addr, "???");
10441044

1045+
if (conn->pghostaddr&&conn->pghostaddr[0]!='\0')
1046+
displayed_host=conn->pghostaddr;
1047+
elseif (conn->pghost&&conn->pghost[0]!='\0')
1048+
displayed_host=conn->pghost;
1049+
else
1050+
displayed_host=DefaultHost;
1051+
10451052
/*
10461053
* If the user did not supply an IP address using 'hostaddr', and
10471054
* 'host' was missing or does not match our lookup, display the
10481055
* looked-up IP address.
10491056
*/
1050-
display_host_addr= (conn->pghostaddr==NULL)&&
1051-
((conn->pghost==NULL)||
1052-
(strcmp(conn->pghost,host_addr)!=0));
1053-
1054-
appendPQExpBuffer(&conn->errorMessage,
1055-
libpq_gettext("could not connect to server: %s\n"
1056-
"\tIs the server running on host \"%s\"%s%s%s and accepting\n"
1057-
"\tTCP/IP connections on port %s?\n"),
1058-
SOCK_STRERROR(errorno,sebuf,sizeof(sebuf)),
1059-
(conn->pghostaddr&&conn->pghostaddr[0]!='\0')
1060-
?conn->pghostaddr
1061-
: (conn->pghost&&conn->pghost[0]!='\0')
1062-
?conn->pghost
1063-
:DefaultHost,
1064-
/* display the IP address only if not already output */
1065-
display_host_addr ?" (" :"",
1066-
display_host_addr ?host_addr :"",
1067-
display_host_addr ?")" :"",
1068-
conn->pgport);
1057+
if ((conn->pghostaddr==NULL)&&
1058+
(conn->pghost==NULL||strcmp(conn->pghost,host_addr)!=0))
1059+
appendPQExpBuffer(&conn->errorMessage,
1060+
libpq_gettext("could not connect to server: %s\n"
1061+
"\tIs the server running on host \"%s\" (%s) and accepting\n"
1062+
"\tTCP/IP connections on port %s?\n"),
1063+
SOCK_STRERROR(errorno,sebuf,sizeof(sebuf)),
1064+
displayed_host,
1065+
host_addr,
1066+
conn->pgport);
1067+
else
1068+
appendPQExpBuffer(&conn->errorMessage,
1069+
libpq_gettext("could not connect to server: %s\n"
1070+
"\tIs the server running on host \"%s\" and accepting\n"
1071+
"\tTCP/IP connections on port %s?\n"),
1072+
SOCK_STRERROR(errorno,sebuf,sizeof(sebuf)),
1073+
displayed_host,
1074+
conn->pgport);
10691075
}
10701076
}
10711077

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp