On 21.06.24 16:53, Tom Lane wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
>> - strlcpy(errbuf, strerror(ERR_GET_REASON(ecode)), SSL_ERR_LEN);
>> + strerror_r(ERR_GET_REASON(ecode), errbuf, SSL_ERR_LEN);
>
> Most of libpq gets at strerror_r via SOCK_STRERROR for Windows
> portability. Is that relevant here?
Looking inside the OpenSSL code, it makes no efforts to translate
between winsock error codes and standard error codes, so I don't think
our workaround/replacement code needs to do that either.
Btw., our source code comments say something like
"ERR_reason_error_string randomly refuses to map system errno values."
The reason it doesn't is exactly that it can't do it while maintaining
thread-safety. Here is the relevant commit:
https://github.com/openssl/openssl/commit/71f2994b15