| 1549 | #define SSL_ERR_LEN 128 |
| 1550 | |
| 1551 | static char * |
| 1552 | SSLerrmessage(unsigned long ecode) |
| 1553 | { |
| 1554 | const char *errreason; |
| 1555 | char *errbuf; |
| 1556 | |
| 1557 | errbuf = malloc(SSL_ERR_LEN); |
| 1558 | if (!errbuf) |
| 1559 | return ssl_nomem; |
| 1560 | if (ecode == 0) |
| 1561 | { |
| 1562 | snprintf(errbuf, SSL_ERR_LEN, libpq_gettext("no SSL error reported")); |
| 1563 | return errbuf; |
| 1564 | } |
| 1565 | errreason = ERR_reason_error_string(ecode); |
| 1566 | if (errreason != NULL) |
| 1567 | { |
| 1568 | strlcpy(errbuf, errreason, SSL_ERR_LEN); |
| 1569 | return errbuf; |
| 1570 | } |
| 1571 | snprintf(errbuf, SSL_ERR_LEN, libpq_gettext("SSL error code %lu"), ecode); |
| 1572 | return errbuf; |
| 1573 | } |
| 1574 | |
| 1575 | static void |
| 1576 | SSLerrfree(char *buf) |
no test coverage detected