@@ -52,8 +52,8 @@ get_db_conn(ClusterInfo *cluster, const char *db_name)
52
52
char conn_opts [MAXPGPATH ];
53
53
54
54
snprintf (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 );
57
57
58
58
return PQconnectdb (conn_opts );
59
59
}
@@ -146,16 +146,18 @@ start_postmaster(ClusterInfo *cluster)
146
146
PGconn * conn ;
147
147
bool exit_hook_registered = false;
148
148
int pg_ctl_return = 0 ;
149
+
149
150
#ifndef WIN32
150
- char * output_filename = log_opts .filename ;
151
+ char * output_filename = log_opts .filename ;
151
152
#else
153
+
152
154
/*
153
155
* On Win32, we can't send both pg_upgrade output and pg_ctl output to the
154
156
* same file because we get the error: "The process cannot access the file
155
157
* because it is being used by another process." so we have to send all
156
158
* other output to 'nul'.
157
159
*/
158
- char * output_filename = DEVNULL ;
160
+ char * output_filename = DEVNULL ;
159
161
#endif
160
162
161
163
if (!exit_hook_registered )
@@ -180,13 +182,13 @@ start_postmaster(ClusterInfo *cluster)
180
182
"-o \"-p %d %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE ,
181
183
cluster -> bindir , output_filename , cluster -> pgdata , cluster -> port ,
182
184
(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" ,
185
187
log_opts .filename );
186
188
187
189
/*
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.
190
192
*/
191
193
pg_ctl_return = exec_prog (false, "%s" , cmd );
192
194
@@ -196,7 +198,7 @@ start_postmaster(ClusterInfo *cluster)
196
198
{
197
199
pg_log (PG_REPORT , "\nconnection to database failed: %s\n" ,
198
200
PQerrorMessage (conn ));
199
- if (conn )
201
+ if (conn )
200
202
PQfinish (conn );
201
203
pg_log (PG_FATAL , "unable to connect to %s postmaster started with the command: %s\n" ,
202
204
CLUSTER_NAME (cluster ), cmd );
@@ -206,8 +208,8 @@ start_postmaster(ClusterInfo *cluster)
206
208
/* If the connection didn't fail, fail now */
207
209
if (pg_ctl_return != 0 )
208
210
pg_log (PG_FATAL , "pg_ctl failed to start the %s server\n" ,
209
- CLUSTER_NAME (cluster ));
210
-
211
+ CLUSTER_NAME (cluster ));
212
+
211
213
os_info .running_cluster = cluster ;
212
214
}
213
215
@@ -218,11 +220,12 @@ stop_postmaster(bool fast)
218
220
char cmd [MAXPGPATH ];
219
221
const char * bindir ;
220
222
const char * datadir ;
223
+
221
224
#ifndef WIN32
222
- char * output_filename = log_opts .filename ;
225
+ char * output_filename = log_opts .filename ;
223
226
#else
224
227
/* See comment in start_postmaster() about why win32 output is ignored. */
225
- char * output_filename = DEVNULL ;
228
+ char * output_filename = DEVNULL ;
226
229
#endif
227
230
228
231
if (os_info .running_cluster == & old_cluster )
@@ -268,17 +271,17 @@ check_pghost_envvar(void)
268
271
for (option = start ; option -> keyword != NULL ; option ++ )
269
272
{
270
273
if (option -> envvar && (strcmp (option -> envvar , "PGHOST" ) == 0 ||
271
- strcmp (option -> envvar , "PGHOSTADDR" ) == 0 ))
274
+ strcmp (option -> envvar , "PGHOSTADDR" ) == 0 ))
272
275
{
273
276
const char * value = getenv (option -> envvar );
274
277
275
278
if (value && strlen (value ) > 0 &&
276
- /* check for 'local' host values */
279
+ /* check for 'local' host values */
277
280
(strcmp (value , "localhost" ) != 0 && strcmp (value , "127.0.0.1" ) != 0 &&
278
281
strcmp (value , "::1" ) != 0 && value [0 ] != '/' ))
279
282
pg_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 );
282
285
}
283
286
}
284
287
0 commit comments