summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/option.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2012-05-23 20:19:21 -0400
committerBruce Momjian <bruce@momjian.us>2012-05-23 20:19:34 -0400
commit476291bef0985e242685fcd37866fec7ab1b97c7 (patch)
tree6f629b0373b3c4225153c1b25c88cfc6feadc8bd /contrib/pg_upgrade/option.c
parent77f93cb32d8711926b07030c1c73a57a7bc66911 (diff)
Adjust pg_upgrade to output a separate log file for pg_ctl output on
Windows, to avoid opening a file by multiple processes.
Diffstat (limited to 'contrib/pg_upgrade/option.c')
-rw-r--r--contrib/pg_upgrade/option.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
index 06af6d42781..66a70cac8ac 100644
--- a/contrib/pg_upgrade/option.c
+++ b/contrib/pg_upgrade/option.c
@@ -57,7 +57,7 @@ parseCommandLine(int argc, char *argv[])
int optindex = 0; /* used by getopt_long */
int os_user_effective_id;
FILE *fp;
- int i;
+ char **filename;
time_t run_time = time(NULL);
user_opts.transfer_mode = TRANSFER_MODE_COPY;
@@ -188,11 +188,12 @@ parseCommandLine(int argc, char *argv[])
}
/* label start of upgrade in logfiles */
- for (i = 0; i < NUM_LOG_FILES; i++)
+ for (filename = output_files; *filename != NULL; filename++)
{
- if ((fp = fopen_priv(output_files[i], "a")) == NULL)
- pg_log(PG_FATAL, "cannot write to log file %s\n",
- output_files[i]);
+ if ((fp = fopen_priv(*filename, "a")) == NULL)
+ pg_log(PG_FATAL, "cannot write to log file %s\n", *filename);
+
+ /* Start with newline because we might be appending to a file. */
fprintf(fp, "\n"
"-----------------------------------------------------------------\n"
" pg_upgrade run on %s"