diff options
author | Heikki Linnakangas | 2013-01-15 16:54:03 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2013-01-15 17:25:53 +0000 |
commit | 20df7e9053799ee80e4e97088c5398dbdd76196f (patch) | |
tree | 66ab6613b70f14080745c5d5f555c207498b827e | |
parent | e2120d756885ce03e7b75b6aec2e93a63ce68a85 (diff) |
Don't pass NULL to fprintf, if not currently connected to a database.
Backpatch all the way to 8.3. Fixes bug #7811, per report and diagnosis by
Meng Qingzhong.
-rw-r--r-- | src/bin/psql/help.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index bf3cc25b4cc..12ea5fdac0e 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -161,6 +161,11 @@ void slashUsage(unsigned short int pager) { FILE *output; + char *currdb; + + currdb = PQdb(pset.db); + if (currdb == NULL) + currdb = _("none"); output = PageOutput(86, pager); @@ -244,7 +249,7 @@ slashUsage(unsigned short int pager) fprintf(output, _("Connection\n")); fprintf(output, _(" \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n" " connect to new database (currently \"%s\")\n"), - PQdb(pset.db)); + currdb); fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n")); fprintf(output, _(" \\password [USERNAME] securely change the password for a user\n")); fprintf(output, "\n"); |