diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-30 03:45:53 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-30 03:45:53 +0000 |
| commit | eb63765a389b020a86fd04cf9333027d37b8f572 (patch) | |
| tree | a791678ee59da015296aa7eff1052ef34f77f726 /src/interfaces | |
| parent | b1ffbaeddcd05f61b0ad115ec3c13b2a1c65d721 (diff) | |
Set errno to zero before invoking SSL_read or SSL_write. It appears that
at least in some Windows versions, these functions are capable of returning
a failure indication without setting errno. That puts us into an infinite
loop if the previous value happened to be EINTR. Per report from Brendan
Hill.
Back-patch to 8.2. We could take it further back, but since this is only
known to be an issue on Windows and we don't support Windows before 8.2,
it does not seem worth the trouble.
Diffstat (limited to 'src/interfaces')
| -rw-r--r-- | src/interfaces/libpq/fe-secure.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 4a12bd1b1da..03318424abd 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.127.2.1 2009/12/09 06:37:29 mha Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.127.2.2 2009/12/30 03:45:53 tgl Exp $ * * NOTES * @@ -288,6 +288,7 @@ pqsecure_read(PGconn *conn, void *ptr, size_t len) DISABLE_SIGPIPE(return -1); rloop: + SOCK_ERRNO_SET(0); n = SSL_read(conn->ssl, ptr, len); err = SSL_get_error(conn->ssl, n); switch (err) @@ -372,6 +373,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len) { int err; + SOCK_ERRNO_SET(0); n = SSL_write(conn->ssl, ptr, len); err = SSL_get_error(conn->ssl, n); switch (err) |
