Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fb3c38

Browse files
committed
libpq: Message style improvements
1 parent 95e12d4 commit 7fb3c38

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,7 @@ pqConnectOptions2(PGconn *conn)
21412141
if (conn->min_pversion > conn->max_pversion)
21422142
{
21432143
conn->status = CONNECTION_BAD;
2144-
libpq_append_conn_error(conn, "min_protocol_version is greater than max_protocol_version");
2144+
libpq_append_conn_error(conn, "\"%s\" is greater than \"%s\"", "min_protocol_version", "max_protocol_version");
21452145
return false;
21462146
}
21472147

src/interfaces/libpq/fe-protocol3.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
14341434
/* 3.1 never existed, we went straight from 3.0 to 3.2 */
14351435
if (their_version == PG_PROTOCOL(3, 1))
14361436
{
1437-
libpq_append_conn_error(conn, "received invalid protocol negotiation message: server requests downgrade to non-existent 3.1 protocol version");
1437+
libpq_append_conn_error(conn, "received invalid protocol negotiation message: server requested downgrade to non-existent 3.1 protocol version");
14381438
goto failure;
14391439
}
14401440

@@ -1452,9 +1452,10 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
14521452

14531453
if (their_version < conn->min_pversion)
14541454
{
1455-
libpq_append_conn_error(conn, "server only supports protocol version %d.%d, but min_protocol_version was set to %d.%d",
1455+
libpq_append_conn_error(conn, "server only supports protocol version %d.%d, but \"%s\" was set to %d.%d",
14561456
PG_PROTOCOL_MAJOR(their_version),
14571457
PG_PROTOCOL_MINOR(their_version),
1458+
"min_protocol_version",
14581459
PG_PROTOCOL_MAJOR(conn->min_pversion),
14591460
PG_PROTOCOL_MINOR(conn->min_pversion));
14601461

@@ -1476,7 +1477,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
14761477
}
14771478
if (strncmp(conn->workBuffer.data, "_pq_.", 5) != 0)
14781479
{
1479-
libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported unsupported parameter name without a _pq_. prefix (\"%s\")", conn->workBuffer.data);
1480+
libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported unsupported parameter name without a \"%s\" prefix (\"%s\")", "_pq_.", conn->workBuffer.data);
14801481
goto failure;
14811482
}
14821483
libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported an unsupported parameter that was not requested (\"%s\")", conn->workBuffer.data);

src/interfaces/libpq/fe-secure-openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,15 @@ SSL_CTX_keylog_cb(const SSL *ssl, const char *line)
711711

712712
if (fd == -1)
713713
{
714-
libpq_append_conn_error(conn, "could not open ssl keylog file \"%s\": %s",
714+
libpq_append_conn_error(conn, "could not open SSL key logging file \"%s\": %s",
715715
conn->sslkeylogfile, pg_strerror(errno));
716716
return;
717717
}
718718

719719
/* line is guaranteed by OpenSSL to be NUL terminated */
720720
rc = write(fd, line, strlen(line));
721721
if (rc < 0)
722-
libpq_append_conn_error(conn, "could not write to ssl keylog file \"%s\": %s",
722+
libpq_append_conn_error(conn, "could not write to SSL key logging file \"%s\": %s",
723723
conn->sslkeylogfile, pg_strerror(errno));
724724
else
725725
rc = write(fd, "\n", 1);

0 commit comments

Comments
 (0)