postgres.git / summary / log / commit / refs
commit feae7c3d2bedfccf8c61fafd372b9ddcdae8cc0d
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Wed Feb 20 14:22:47 2013 +0000
First released in: 9.3.0, 8.4.17, 9.0.13, 9.1.9, 9.2.4
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
Back-patch to all supported branches.
src/bin/pg_dump/pg_backup_db.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index 28e2a0236ae..401a6a5a647 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -305,7 +305,8 @@ ConnectDatabase(Archive *AHX,
/* check to see that the backend connection was successfully made */
if (PQstatus(AH->connection) == CONNECTION_BAD)
die_horribly(AH, modulename, "connection to database \"%s\" failed: %s",
- PQdb(AH->connection), PQerrorMessage(AH->connection));
+ PQdb(AH->connection) ? PQdb(AH->connection) : "",
+ PQerrorMessage(AH->connection));
/* check for version mismatch */
_check_database_version(AH);
[parent: 04d7fa5e31f0]