aboutsummaryrefslogtreecommitdiff
path: root/src
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:16 +0200
commit5c97528df0053a4f92d020474636bde398f697ec (patch)
tree963176b60295ed0c54a04cb15295c31bb29a6db9 /src
parentb5ec56f664fa20d80fe752de494ec96362eff520 (diff)
downloadpostgresql-5c97528df0053a4f92d020474636bde398f697ec.tar.gz
postgresql-5c97528df0053a4f92d020474636bde398f697ec.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')
-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 c295fc5ddd2..21d050ffa01 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -301,7 +301,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);