Commit cd917ffb authored by Peter Eisentraut's avatar Peter Eisentraut

pg_upgrade: Improve error messages

Make wording more accurate and add strerror() information.

Discussion: https://www.postgresql.org/message-id/24c8bd05-aed1-6301-919d-8acbabdb8c24@2ndquadrant.com
parent aba78ab4
...@@ -146,7 +146,7 @@ exec_prog(const char *log_file, const char *opt_log_file, ...@@ -146,7 +146,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
#endif #endif
if (log == NULL) if (log == NULL)
pg_fatal("could not write to log file \"%s\"\n", log_file); pg_fatal("could not open log file \"%s\": %m\n", log_file);
#ifdef WIN32 #ifdef WIN32
/* Are we printing "command:" before its output? */ /* Are we printing "command:" before its output? */
...@@ -201,7 +201,7 @@ exec_prog(const char *log_file, const char *opt_log_file, ...@@ -201,7 +201,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
* log these commands to a third file, but that just adds complexity. * log these commands to a third file, but that just adds complexity.
*/ */
if ((log = fopen(log_file, "a")) == NULL) if ((log = fopen(log_file, "a")) == NULL)
pg_fatal("could not write to log file \"%s\"\n", log_file); pg_fatal("could not write to log file \"%s\": %m\n", log_file);
fprintf(log, "\n\n"); fprintf(log, "\n\n");
fclose(log); fclose(log);
#endif #endif
......
...@@ -217,7 +217,7 @@ parseCommandLine(int argc, char *argv[]) ...@@ -217,7 +217,7 @@ parseCommandLine(int argc, char *argv[])
} }
if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL) if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL)
pg_fatal("could not write to log file \"%s\"\n", INTERNAL_LOG_FILE); pg_fatal("could not open log file \"%s\": %m\n", INTERNAL_LOG_FILE);
if (log_opts.verbose) if (log_opts.verbose)
pg_log(PG_REPORT, "Running in verbose mode\n"); pg_log(PG_REPORT, "Running in verbose mode\n");
...@@ -226,7 +226,7 @@ parseCommandLine(int argc, char *argv[]) ...@@ -226,7 +226,7 @@ parseCommandLine(int argc, char *argv[])
for (filename = output_files; *filename != NULL; filename++) for (filename = output_files; *filename != NULL; filename++)
{ {
if ((fp = fopen_priv(*filename, "a")) == NULL) if ((fp = fopen_priv(*filename, "a")) == NULL)
pg_fatal("could not write to log file \"%s\"\n", *filename); pg_fatal("could not write to log file \"%s\": %m\n", *filename);
/* Start with newline because we might be appending to a file. */ /* Start with newline because we might be appending to a file. */
fprintf(fp, "\n" fprintf(fp, "\n"
......
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