]> 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:34:29 +0000 (16:34 +0200)
Back-patch to all supported branches.

src/bin/pg_dump/pg_backup_db.c

index 2d2ddf61f7adf7e3132980020937ca8c01dd8323..3851398b1df0d87e333862556deaa8b5506e77ef 100644 (file)
@@ -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);