summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2013-02-20 14:22:47 +0000
committerHeikki Linnakangas2013-02-20 14:34:34 +0000
commitf835b71750c58319906aa36c4f00812843f97eb9 (patch)
treeddf5e9d6b5e26c2738401cc2ac9f8de3474f6cfd
parent697f5cadf5d81eeee3f3018d711ef33261dc7cd5 (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 b04784e0f9a..3bfcaf8db07 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -255,7 +255,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);