Commit 34f34a04 authored by Bruce Momjian's avatar Bruce Momjian

Fix pg_ctl -w to properly wait on server startup.

parent 3bd72633
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.24 2004/07/29 16:11:11 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.25 2004/08/21 03:12:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -404,12 +404,23 @@ test_postmaster_connection(void) ...@@ -404,12 +404,23 @@ test_postmaster_connection(void)
for (i = 0; i < wait_seconds; i++) for (i = 0; i < wait_seconds; i++)
{ {
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL, "template1", NULL, NULL)) != NULL) if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
"template1", NULL, NULL)) != NULL &&
PQstatus(conn) == CONNECTION_OK)
{ {
PQfinish(conn); PQfinish(conn);
success = true; success = true;
break; break;
} }
else
{
if (!silence_echo)
{
printf(".");
fflush(stdout);
}
pg_usleep(1000000); /* 1 sec */
}
} }
return success; return success;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment