]> granicus.if.org Git - postgresql/commitdiff
pg_upgrade: Improve error messages
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 19 Jun 2019 19:49:03 +0000 (21:49 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 19 Jun 2019 19:50:24 +0000 (21:50 +0200)
Make wording more accurate and add strerror() information.

Discussion: https://www.postgresql.org/message-id/24c8bd05-aed1-6301-919d-8acbabdb8c24@2ndquadrant.com

src/bin/pg_upgrade/exec.c
src/bin/pg_upgrade/option.c

index 043373f9a5dcd316b7b0f917acf8e3c610304139..036330932820ddc17a719cce8fedfce42c7f9bf1 100644 (file)
@@ -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
index 873d1d07e4881b3be4b537b9583d289582eb389b..73f395f2a3509ac401451375529e6555b8a2f665 100644 (file)
@@ -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"