diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-09-26 12:35:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-09-26 12:35:57 -0400 |
commit | 758ce9b7794845f95473c569155d29fcf0e2751b (patch) | |
tree | 9110f776f5f665b4cfff55223c7e0f2da47ffaaf /src/interfaces/libpq/fe-secure-openssl.c | |
parent | 26e9d4d4ef16b5e2be96319f89ea6ba7f63a4d73 (diff) | |
download | postgresql-758ce9b7794845f95473c569155d29fcf0e2751b.tar.gz postgresql-758ce9b7794845f95473c569155d29fcf0e2751b.zip |
Incorporate strerror_r() into src/port/snprintf.c, too.
This provides the features that used to exist in useful_strerror()
for users of strerror_r(), too. Also, standardize on the GNU convention
that strerror_r returns a char pointer that may not be NULL.
I notice that libpq's win32.c contains a variant version of strerror_r
that probably ought to be folded into strerror.c. But lacking a
Windows environment, I should leave that to somebody else.
Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
Diffstat (limited to 'src/interfaces/libpq/fe-secure-openssl.c')
-rw-r--r-- | src/interfaces/libpq/fe-secure-openssl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index bbae8eff813..beca3492e8d 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -142,7 +142,7 @@ pgtls_read(PGconn *conn, void *ptr, size_t len) { ssize_t n; int result_errno = 0; - char sebuf[256]; + char sebuf[PG_STRERROR_R_BUFLEN]; int err; unsigned long ecode; @@ -272,7 +272,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) { ssize_t n; int result_errno = 0; - char sebuf[256]; + char sebuf[PG_STRERROR_R_BUFLEN]; int err; unsigned long ecode; @@ -443,7 +443,7 @@ pgtls_get_peer_certificate_hash(PGconn *conn, size_t *len) return cert_hash; } -#endif /* HAVE_X509_GET_SIGNATURE_NID */ +#endif /* HAVE_X509_GET_SIGNATURE_NID */ /* ------------------------------------------------------------ */ /* OpenSSL specific code */ @@ -780,7 +780,7 @@ initialize_SSL(PGconn *conn) struct stat buf; char homedir[MAXPGPATH]; char fnbuf[MAXPGPATH]; - char sebuf[256]; + char sebuf[PG_STRERROR_R_BUFLEN]; bool have_homedir; bool have_cert; bool have_rootcert; @@ -941,7 +941,7 @@ initialize_SSL(PGconn *conn) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not open certificate file \"%s\": %s\n"), - fnbuf, pqStrerror(errno, sebuf, sizeof(sebuf))); + fnbuf, strerror_r(errno, sebuf, sizeof(sebuf))); SSL_CTX_free(SSL_context); return -1; } @@ -1212,7 +1212,7 @@ open_client_SSL(PGconn *conn) case SSL_ERROR_SYSCALL: { - char sebuf[256]; + char sebuf[PG_STRERROR_R_BUFLEN]; if (r == -1) printfPQExpBuffer(&conn->errorMessage, |