Here's another one similar to what I described in my previous message. In
libpq's pqsecure_read(), if SSL_read() returns -1 and sets an error of
SSL_ERROR_SYSCALL, errno may be polluted by libpq_gettext() before a
human-readable string is derived from it. Also, pqReadData() will see the
wrong errno value after the call.
The attached patch fixes both by introducing a named variable to hold the
significant value of errno.
Jeroen
--- fe-secure.c.org 2005-07-05 19:45:19.000000000 +0700
+++ fe-secure.c 2005-07-05 19:55:26.000000000 +0700
@@ -340,9 +340,13 @@
char sebuf[256];
if (n == -1)
+ {
+ const int errcode = SOCK_ERRNO;
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("SSL SYSCALL error: %s\n"),
- SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
+ SOCK_STRERROR(errcode, sebuf, sizeof(sebuf)));
+ SOCK_ERRNO_SET(errcode);
+ }
else
{
printfPQExpBuffer(&conn->errorMessage,
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match