summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-02-20 16:22:47 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-02-20 16:34:32 +0200
commitfeae7c3d2bedfccf8c61fafd372b9ddcdae8cc0d (patch)
treec3f8ba48cf9da4101e3ecd2866a719f6c1226c58
parent04d7fa5e31f094bd1d87e2da93ba1786a882884f (diff)
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
Back-patch to all supported branches.
-rw-r--r--src/bin/pg_dump/pg_backup_db.c3
1 files changed, 2 insertions, 1 deletions
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);