From 4a6285ee445efc13f0e726be1629762ff366e602 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun, 17 Jan 1999 03:37:19 +0000
Subject: [PATCH] Improve error message when connect() call fails: report
 kernel's errno value.

---
 src/interfaces/libpq/fe-connect.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 9e5b76bab5d..cb515be8f3a 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.86 1998/10/14 05:31:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.87 1999/01/17 03:37:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -584,9 +584,12 @@ connectDB(PGconn *conn)
 	if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) < 0)
 	{
 		(void) sprintf(conn->errorMessage,
-					   "connectDB() failed: Is the postmaster running and accepting%s connections at '%s' on port '%s'?\n",
-					   conn->pghost ? " TCP/IP(with -i)" : "",
-					   conn->pghost ? conn->pghost : "UNIX Socket",
+					   "connectDB() -- connect() failed: %s\n"
+					   "Is the postmaster running%s at '%s' and accepting connections on %s '%s'?\n",
+					   strerror(errno),
+					   (family == AF_INET) ? " (with -i)" : "",
+					   conn->pghost ? conn->pghost : "localhost",
+					   (family == AF_INET) ? "TCP/IP port" : "Unix socket",
 					   conn->pgport);
 		goto connect_errReturn;
 	}
-- 
GitLab