Skip to content

Commit cd917ff

Browse files
committed
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
1 parent aba78ab commit cd917ff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/bin/pg_upgrade/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
146146
#endif
147147

148148
if (log == NULL)
149-
pg_fatal("could not write to log file \"%s\"\n", log_file);
149+
pg_fatal("could not open log file \"%s\": %m\n", log_file);
150150

151151
#ifdef WIN32
152152
/* Are we printing "command:" before its output? */
@@ -201,7 +201,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
201201
* log these commands to a third file, but that just adds complexity.
202202
*/
203203
if ((log = fopen(log_file, "a")) == NULL)
204-
pg_fatal("could not write to log file \"%s\"\n", log_file);
204+
pg_fatal("could not write to log file \"%s\": %m\n", log_file);
205205
fprintf(log, "\n\n");
206206
fclose(log);
207207
#endif

src/bin/pg_upgrade/option.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ parseCommandLine(int argc, char *argv[])
217217
}
218218

219219
if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL)
220-
pg_fatal("could not write to log file \"%s\"\n", INTERNAL_LOG_FILE);
220+
pg_fatal("could not open log file \"%s\": %m\n", INTERNAL_LOG_FILE);
221221

222222
if (log_opts.verbose)
223223
pg_log(PG_REPORT, "Running in verbose mode\n");
@@ -226,7 +226,7 @@ parseCommandLine(int argc, char *argv[])
226226
for (filename = output_files; *filename != NULL; filename++)
227227
{
228228
if ((fp = fopen_priv(*filename, "a")) == NULL)
229-
pg_fatal("could not write to log file \"%s\"\n", *filename);
229+
pg_fatal("could not write to log file \"%s\": %m\n", *filename);
230230

231231
/* Start with newline because we might be appending to a file. */
232232
fprintf(fp, "\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy