Fix to show wrong error.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 25 Dec 2015 08:40:51 +0000 (17:40 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 25 Dec 2015 08:44:15 +0000 (17:44 +0900)
connect_with_timeout() does not show proper error info when
getsockopt(SO_ERROR) reports an error. Pointed out in bug#159.

src/protocol/pool_connection_pool.c

index f8814e305de13bf2bb5738e5251cdf844440b0f2..9ba7746fd0e759032b83306fe6f23d12ace4d8d0 100644 (file)
@@ -662,7 +662,7 @@ static bool connect_with_timeout(int fd, struct addrinfo *walk, char *host, int
                                        if (error != 0)
                                        {
                                                ereport(LOG,
-                                                               (errmsg("failed to connect to PostgreSQL server on \"%s:%d\", getsockopt() detected error \"%s\"",host,port,strerror(errno))));
+                                                               (errmsg("failed to connect to PostgreSQL server on \"%s:%d\", getsockopt() detected error \"%s\"",host,port,strerror(error))));
                                                return false;
                                        }
                                }