forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita099482
committed
Expect EWOULDBLOCK from a non-blocking connect() call only on Windows.
On Unix-ish platforms, EWOULDBLOCK may be the same as EAGAIN, which is*not* a success return, at least not on Linux. We need to treat it as afailure to avoid giving a misleading error message. Per the Single UnixSpec, only EINPROGRESS and EINTR returns indicate that the connectionattempt is in progress.On Windows, on the other hand, EWOULDBLOCK (WSAEWOULDBLOCK) is the expectedcase. We must accept EINPROGRESS as well because Cygwin will return that,and it doesn't seem worth distinguishing Cygwin from native Windows here.It's not very clear whether EINTR can occur on Windows, but let's leavethat part of the logic alone in the absence of concrete trouble reports.Also, remove the test for errno == 0, effectively reverting commitda9501b, which AFAICS was just a thinko;or at best it might have been a workaround for a platform-specific bug,which we can hope is gone now thirteen years later. In any case, sincelibpq makes no effort to reset errno to zero before calling connect(),it seems unlikely that that test has ever reliably done anything useful.Andres Freund and Tom Lane1 parenta2769a4 commita099482
1 file changed
+3
-2
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1780 | 1780 |
| |
1781 | 1781 |
| |
1782 | 1782 |
| |
| 1783 | + | |
1783 | 1784 |
| |
1784 |
| - | |
1785 |
| - | |
| 1785 | + | |
| 1786 | + | |
1786 | 1787 |
| |
1787 | 1788 |
| |
1788 | 1789 |
| |
|
0 commit comments
Comments
(0)