summaryrefslogtreecommitdiff
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:29 +0200
commit23ef96327f9ea2a0213d05831175a3ac1b472f29 (patch)
tree698768b61e43d2d6c364d099576ebbe532164515 /src
parentf73a16340c3eba317ab433466b9ad9eb2f962020 (diff)
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 2d2ddf61f7a..3851398b1df 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);