@@ -52,8 +52,8 @@ get_db_conn(ClusterInfo *cluster, const char *db_name)
5252char conn_opts [MAXPGPATH ];
5353
5454snprintf (conn_opts ,sizeof (conn_opts ),
55- "dbname = '%s' user = '%s' port = %d" ,db_name ,os_info .user ,
56- cluster -> port );
55+ "dbname = '%s' user = '%s' port = %d" ,db_name ,os_info .user ,
56+ cluster -> port );
5757
5858return PQconnectdb (conn_opts );
5959}
@@ -146,16 +146,18 @@ start_postmaster(ClusterInfo *cluster)
146146PGconn * conn ;
147147bool exit_hook_registered = false;
148148int pg_ctl_return = 0 ;
149+
149150#ifndef WIN32
150- char * output_filename = log_opts .filename ;
151+ char * output_filename = log_opts .filename ;
151152#else
153+
152154/*
153155 * On Win32, we can't send both pg_upgrade output and pg_ctl output to the
154156 * same file because we get the error: "The process cannot access the file
155157 * because it is being used by another process." so we have to send all
156158 * other output to 'nul'.
157159 */
158- char * output_filename = DEVNULL ;
160+ char * output_filename = DEVNULL ;
159161#endif
160162
161163if (!exit_hook_registered )
@@ -180,13 +182,13 @@ start_postmaster(ClusterInfo *cluster)
180182"-o \"-p %d %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE ,
181183cluster -> bindir ,output_filename ,cluster -> pgdata ,cluster -> port ,
182184 (cluster -> controldata .cat_ver >=
183- BINARY_UPGRADE_SERVER_FLAG_CAT_VER ) ?"-b" :
184- "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000" ,
185+ BINARY_UPGRADE_SERVER_FLAG_CAT_VER ) ?"-b" :
186+ "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000" ,
185187log_opts .filename );
186188
187189/*
188- * Don't throw an error right away, let connecting throw the error
189- *because it might supply a reason for the failure.
190+ * Don't throw an error right away, let connecting throw the error because
191+ * it might supply a reason for the failure.
190192 */
191193pg_ctl_return = exec_prog (false,"%s" ,cmd );
192194
@@ -196,7 +198,7 @@ start_postmaster(ClusterInfo *cluster)
196198{
197199pg_log (PG_REPORT ,"\nconnection to database failed: %s\n" ,
198200PQerrorMessage (conn ));
199- if (conn )
201+ if (conn )
200202PQfinish (conn );
201203pg_log (PG_FATAL ,"unable to connect to %s postmaster started with the command: %s\n" ,
202204CLUSTER_NAME (cluster ),cmd );
@@ -206,8 +208,8 @@ start_postmaster(ClusterInfo *cluster)
206208/* If the connection didn't fail, fail now */
207209if (pg_ctl_return != 0 )
208210pg_log (PG_FATAL ,"pg_ctl failed to start the %s server\n" ,
209- CLUSTER_NAME (cluster ));
210-
211+ CLUSTER_NAME (cluster ));
212+
211213os_info .running_cluster = cluster ;
212214}
213215
@@ -218,11 +220,12 @@ stop_postmaster(bool fast)
218220char cmd [MAXPGPATH ];
219221const char * bindir ;
220222const char * datadir ;
223+
221224#ifndef WIN32
222- char * output_filename = log_opts .filename ;
225+ char * output_filename = log_opts .filename ;
223226#else
224227/* See comment in start_postmaster() about why win32 output is ignored. */
225- char * output_filename = DEVNULL ;
228+ char * output_filename = DEVNULL ;
226229#endif
227230
228231if (os_info .running_cluster == & old_cluster )
@@ -268,17 +271,17 @@ check_pghost_envvar(void)
268271for (option = start ;option -> keyword != NULL ;option ++ )
269272{
270273if (option -> envvar && (strcmp (option -> envvar ,"PGHOST" )== 0 ||
271- strcmp (option -> envvar ,"PGHOSTADDR" )== 0 ))
274+ strcmp (option -> envvar ,"PGHOSTADDR" )== 0 ))
272275{
273276const char * value = getenv (option -> envvar );
274277
275278if (value && strlen (value )> 0 &&
276- /* check for 'local' host values */
279+ /* check for 'local' host values */
277280(strcmp (value ,"localhost" )!= 0 && strcmp (value ,"127.0.0.1" )!= 0 &&
278281strcmp (value ,"::1" )!= 0 && value [0 ]!= '/' ))
279282pg_log (PG_FATAL ,
280- "libpq environment variable %s has a non-local server value: %s\n" ,
281- option -> envvar ,value );
283+ "libpq environment variable %s has a non-local server value: %s\n" ,
284+ option -> envvar ,value );
282285}
283286}
284287