Re: improve ssl error code, 2147483650

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, Pgsql Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: improve ssl error code, 2147483650
Date: 2024-06-25 12:41:38
Message-ID: 3f857dc4-547d-45b7-8e82-ce609c68e3b3@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.06.24 16:53, Tom Lane wrote:
> Peter Eisentraut <peter(at)eisentraut(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-06-25 12:42:02 Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin
Previous Message Dave Page 2024-06-25 12:33:25 Re: Meson far from ready on Windows