]> granicus.if.org Git - postgresql/commitdiff
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 20 Feb 2013 14:22:47 +0000 (16:22 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 20 Feb 2013 14:33:24 +0000 (16:33 +0200)
Back-patch to all supported branches.

src/bin/pg_dump/pg_backup_db.c

index 21c203e8e7b903732eadb69eb75e9b71a571bcca..4c4f24f7d5abd46e72b33cf6ef068f3933a0f1b6 100644 (file)
@@ -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);