Skip to content

Commit 85642ec

Browse files
committed
Prevent pg_upgrade from crashing if it can't write to the current
directory. Backpatch to 9.2.
1 parent 914b130 commit 85642ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/pg_upgrade/util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ pg_log(eLogType type, char *fmt,...)
7878
va_end(args);
7979

8080
/* PG_VERBOSE is only output in verbose mode */
81-
if (type != PG_VERBOSE || log_opts.verbose)
81+
/* fopen() on log_opts.internal might have failed, so check it */
82+
if ((type != PG_VERBOSE || log_opts.verbose) && log_opts.internal != NULL)
8283
{
8384
fwrite(message, strlen(message), 1, log_opts.internal);
8485
/* if we are using OVERWRITE_MESSAGE, add newline to log file */

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