Skip to content

Commit 2930c05

Browse files
committed
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
Back-patch to all supported branches.
1 parent 5d6899d commit 2930c05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_dump/pg_backup_db.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ ConnectDatabase(Archive *AHX,
300300
/* check to see that the backend connection was successfully made */
301301
if (PQstatus(AH->connection) == CONNECTION_BAD)
302302
exit_horribly(modulename, "connection to database \"%s\" failed: %s",
303-
PQdb(AH->connection), PQerrorMessage(AH->connection));
303+
PQdb(AH->connection) ? PQdb(AH->connection) : "",
304+
PQerrorMessage(AH->connection));
304305

305306
/* check for version mismatch */
306307
_check_database_version(AH);

0 commit comments

Comments
 (0)