Re: 9.5: Can't connect with PGSSLMODE=require on Windows - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 9.5: Can't connect with PGSSLMODE=require on Windows
Date
Msg-id 28954.1443473844@sss.pgh.pa.us
Whole thread Raw
In response to Re: 9.5: Can't connect with PGSSLMODE=require on Windows  (Asif Naeem <anaeem.it@gmail.com>)
Responses Re: 9.5: Can't connect with PGSSLMODE=require on Windows  (Andres Freund <andres@anarazel.de>)
Re: 9.5: Can't connect with PGSSLMODE=require on Windows  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Asif Naeem <anaeem.it@gmail.com> writes:
> I have spent sometime to investigate the issue, it is reproduciable. In
> case of Windows, when pqsecure_raw_read() function error code
> WSAEWOULDBLOCK (EWOULDBLOCK) when no data queued to be read from the non
> blocking socket there is a need to log retry flag. Related error code can
> be retrieved via Windows WSAGetLastError() instead of errno, preprocessor
> SOCK_ERRNO handle it gracefully. PFA patch, it resolve the issue i.e.

> @@ -1601,7 +1601,7 @@ my_sock_read(BIO *h, char *buf, int size)
>      int            save_errno;
>  
>      res = pqsecure_raw_read((PGconn *) h->ptr, buf, size);
> -    save_errno = errno;
> +    save_errno = SOCK_ERRNO;
>      BIO_clear_retry_flags(h);
>      if (res < 0)
>      {


Great detective work!  But if that's broken, then surely the identical
code in my_sock_write is as well; and the reassignment to errno at the
bottom of my_sock_read needs to be SOCK_ERRNO_SET(); and why doesn't
my_sock_write have a reassignment at all?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Foreign join pushdown vs EvalPlanQual
Next
From: Stephen Frost
Date:
Subject: Re: row_security GUC, BYPASSRLS