Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4a6285e

Browse files
committed
Improve error message when connect() call fails:
report kernel's errno value.
1 parent4deb20f commit4a6285e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.86 1998/10/14 05:31:48 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.87 1999/01/17 03:37:19 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -584,9 +584,12 @@ connectDB(PGconn *conn)
584584
if (connect(conn->sock,&conn->raddr.sa,conn->raddr_len)<0)
585585
{
586586
(void)sprintf(conn->errorMessage,
587-
"connectDB() failed: Is the postmaster running and accepting%s connections at '%s' on port '%s'?\n",
588-
conn->pghost ?" TCP/IP(with -i)" :"",
589-
conn->pghost ?conn->pghost :"UNIX Socket",
587+
"connectDB() -- connect() failed: %s\n"
588+
"Is the postmaster running%s at '%s' and accepting connections on %s '%s'?\n",
589+
strerror(errno),
590+
(family==AF_INET) ?" (with -i)" :"",
591+
conn->pghost ?conn->pghost :"localhost",
592+
(family==AF_INET) ?"TCP/IP port" :"Unix socket",
590593
conn->pgport);
591594
gotoconnect_errReturn;
592595
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp