diff options
Diffstat (limited to 'src/interfaces/libpq/fe-misc.c')
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index b34bce6031a..9d67623e4af 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -625,7 +625,9 @@ retry3: if (SOCK_ERRNO == ECONNRESET) goto definitelyFailed; #endif - printfPQExpBuffer(&conn->errorMessage, + /* in SSL mode, pqsecure_read set the error message */ + if (conn->ssl == NULL) + printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not receive data from server: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return -1; @@ -715,7 +717,9 @@ retry4: if (SOCK_ERRNO == ECONNRESET) goto definitelyFailed; #endif - printfPQExpBuffer(&conn->errorMessage, + /* in SSL mode, pqsecure_read set the error message */ + if (conn->ssl == NULL) + printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not receive data from server: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return -1; @@ -731,8 +735,10 @@ retry4: * means the connection has been closed. Cope. */ definitelyFailed: - printfPQExpBuffer(&conn->errorMessage, - libpq_gettext( + /* in SSL mode, pqsecure_read set the error message */ + if (conn->ssl == NULL) + printfPQExpBuffer(&conn->errorMessage, + libpq_gettext( "server closed the connection unexpectedly\n" "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); @@ -808,8 +814,10 @@ pqSendSome(PGconn *conn, int len) #ifdef ECONNRESET case ECONNRESET: #endif - printfPQExpBuffer(&conn->errorMessage, - libpq_gettext( + /* in SSL mode, pqsecure_write set the error message */ + if (conn->ssl == NULL) + printfPQExpBuffer(&conn->errorMessage, + libpq_gettext( "server closed the connection unexpectedly\n" "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); @@ -826,7 +834,9 @@ pqSendSome(PGconn *conn, int len) return -1; default: - printfPQExpBuffer(&conn->errorMessage, + /* in SSL mode, pqsecure_write set the error message */ + if (conn->ssl == NULL) + printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not send data to server: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); /* We don't assume it's a fatal error... */ |