> On 14 Apr 2023, at 00:52, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> The attached diff passes the tests on OpenSSL 1.0.1 through 3.1 as well as on
>> LibreSSL. Thoughts?
>
> 1. You can't assume that errno starts out zero, unless you zero it
> right before SSL_connect.
Maybe we should do that regardless of this? We do for reading and writing but
not in open_client_SSL, and I can't off the top of my head think of a good
reason not to?
> 2. I wonder whether it's safe to assume that errno (a/k/a SOCK_ERRNO)
> can't be clobbered by SSL_get_verify_result.
>
> 3. It seems weird to refer to errno directly just a couple lines away
> from where we refer to it via SOCK_ERRNO. Will this even compile
> on Windows?
Good points, it should of course be SOCK_ERRNO. The attached saves off errno
and reinstates it to avoid clobbering. Will test it on Windows in the morning
as well.
--
Daniel Gustafsson