]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Improve error message when connect() call fails:
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Jan 1999 03:37:19 +0000 (03:37 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Jan 1999 03:37:19 +0000 (03:37 +0000)
report kernel's errno value.

src/interfaces/libpq/fe-connect.c

index 9e5b76bab5d4e0e673ae0ad43059d9dd778aa8a8..cb515be8f3a4c911456da7fc6a5efdea3cb28b60 100644 (file)
@@ -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;
        }