1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Rename pg_upgrade 'log' to 'log_opts', to avoid platform naming conflict.

This commit is contained in:
Bruce Momjian
2010-10-20 02:31:17 +00:00
parent 3325c9bddb
commit 691a67b922
8 changed files with 48 additions and 48 deletions

View File

@ -119,11 +119,11 @@ parseCommandLine(int argc, char *argv[])
case 'g':
pg_log(PG_REPORT, "Running in debug mode\n");
log.debug = true;
log_opts.debug = true;
break;
case 'G':
if ((log.debug_fd = fopen(optarg, "w")) == NULL)
if ((log_opts.debug_fd = fopen(optarg, "w")) == NULL)
{
pg_log(PG_FATAL, "cannot open debug file\n");
exit_nicely(false);
@ -135,7 +135,7 @@ parseCommandLine(int argc, char *argv[])
break;
case 'l':
log.filename = pg_strdup(optarg);
log_opts.filename = pg_strdup(optarg);
break;
case 'p':
@ -161,7 +161,7 @@ parseCommandLine(int argc, char *argv[])
case 'v':
pg_log(PG_REPORT, "Running in verbose mode\n");
log.verbose = true;
log_opts.verbose = true;
break;
default:
@ -172,7 +172,7 @@ parseCommandLine(int argc, char *argv[])
}
}
if (log.filename != NULL)
if (log_opts.filename != NULL)
{
/*
* We must use append mode so output generated by child processes via
@ -180,20 +180,20 @@ parseCommandLine(int argc, char *argv[])
* start.
*/
/* truncate */
if ((log.fd = fopen(log.filename, "w")) == NULL)
pg_log(PG_FATAL, "Cannot write to log file %s\n", log.filename);
fclose(log.fd);
if ((log.fd = fopen(log.filename, "a")) == NULL)
pg_log(PG_FATAL, "Cannot write to log file %s\n", log.filename);
if ((log_opts.fd = fopen(log_opts.filename, "w")) == NULL)
pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
fclose(log_opts.fd);
if ((log_opts.fd = fopen(log_opts.filename, "a")) == NULL)
pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
}
else
log.filename = strdup(DEVNULL);
log_opts.filename = strdup(DEVNULL);
/* if no debug file name, output to the terminal */
if (log.debug && !log.debug_fd)
if (log_opts.debug && !log_opts.debug_fd)
{
log.debug_fd = fopen(DEVTTY, "w");
if (!log.debug_fd)
log_opts.debug_fd = fopen(DEVTTY, "w");
if (!log_opts.debug_fd)
pg_log(PG_FATAL, "Cannot write to terminal\n");
}