aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_db.c
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:33:24 +0200
commit2930c05634bcb7491bc443a493405e927ed08443 (patch)
tree5b63021ff2797ec2c4fdccdc5957ecada43e5606 /src/bin/pg_dump/pg_backup_db.c
parent5d6899dbae7ac19d90f135e2ad64832e4ca8d064 (diff)
downloadpostgresql-2930c05634bcb7491bc443a493405e927ed08443.tar.gz
postgresql-2930c05634bcb7491bc443a493405e927ed08443.zip
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
Back-patch to all supported branches.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_db.c')
-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 21c203e8e7b..4c4f24f7d5a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -300,7 +300,8 @@ ConnectDatabase(Archive *AHX,
/* check to see that the backend connection was successfully made */
if (PQstatus(AH->connection) == CONNECTION_BAD)
exit_horribly(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);