summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-06-19 21:49:03 +0200
committerPeter Eisentraut <peter@eisentraut.org>2019-06-19 21:50:24 +0200
commitcd917ffb9a43e9e4699c2a89d495ee02a8701034 (patch)
tree8cbe4f36643dd19c15122dab50dfa6ce8a780639
parentaba78ab4a9509e7ed92acefd707a99425568f49f (diff)
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
-rw-r--r--src/bin/pg_upgrade/exec.c4
-rw-r--r--src/bin/pg_upgrade/option.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 043373f9a5d..03633093282 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -146,7 +146,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
#endif
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
/* Are we printing "command:" before its output? */
@@ -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.
*/
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");
fclose(log);
#endif
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index 873d1d07e48..73f395f2a35 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -217,7 +217,7 @@ parseCommandLine(int argc, char *argv[])
}
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)
pg_log(PG_REPORT, "Running in verbose mode\n");
@@ -226,7 +226,7 @@ parseCommandLine(int argc, char *argv[])
for (filename = output_files; *filename != NULL; filename++)
{
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. */
fprintf(fp, "\n"