1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Factor out system call names from error messages

Instead, put them in via a format placeholder.  This reduces the
number of distinct translatable messages and also reduces the chances
of typos during translation.  We already did this for the system call
arguments in a number of cases, so this is just the same thing taken a
bit further.

Discussion: https://www.postgresql.org/message-id/flat/92d6f545-5102-65d8-3c87-489f71ea0a37%40enterprisedb.com
This commit is contained in:
Peter Eisentraut
2021-04-23 14:18:11 +02:00
parent 9486844f30
commit 82c3cd9741
10 changed files with 55 additions and 52 deletions

View File

@ -1863,7 +1863,8 @@ setKeepalivesIdle(PGconn *conn)
char sebuf[PG_STRERROR_R_BUFLEN];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(%s) failed: %s\n"),
libpq_gettext("%s(%s) failed: %s\n"),
"setsockopt",
PG_TCP_KEEPALIVE_IDLE_STR,
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
@ -1897,7 +1898,8 @@ setKeepalivesInterval(PGconn *conn)
char sebuf[PG_STRERROR_R_BUFLEN];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(%s) failed: %s\n"),
libpq_gettext("%s(%s) failed: %s\n"),
"setsockopt",
"TCP_KEEPINTVL",
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
@ -1932,7 +1934,8 @@ setKeepalivesCount(PGconn *conn)
char sebuf[PG_STRERROR_R_BUFLEN];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(%s) failed: %s\n"),
libpq_gettext("%s(%s) failed: %s\n"),
"setsockopt",
"TCP_KEEPCNT",
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
@ -2019,7 +2022,8 @@ setTCPUserTimeout(PGconn *conn)
char sebuf[256];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(%s) failed: %s\n"),
libpq_gettext("%s(%s) failed: %s\n"),
"setsockopt",
"TCP_USER_TIMEOUT",
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
@ -2632,7 +2636,8 @@ keep_going: /* We will come back to here until there is
(char *) &on, sizeof(on)) < 0)
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(%s) failed: %s\n"),
libpq_gettext("%s(%s) failed: %s\n"),
"setsockopt",
"SO_KEEPALIVE",
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
err = 1;

View File

@ -1080,7 +1080,8 @@ pqSocketCheck(PGconn *conn, int forRead, int forWrite, time_t end_time)
char sebuf[PG_STRERROR_R_BUFLEN];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("select() failed: %s\n"),
libpq_gettext("%s() failed: %s\n"),
"select",
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
}