diff options
| author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-01-15 18:54:03 +0200 |
|---|---|---|
| committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-01-15 19:20:32 +0200 |
| commit | bb9a9a9d37f664c2dd7d715b25058e8bc21f99b0 (patch) | |
| tree | 870987c406573afe3dcafe274b1b738f67c61a03 | |
| parent | 78298daa4e4c890cf397f9aaf4598987bb2f6d5b (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 47fa934db53..213b87c5393 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); @@ -246,7 +251,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"); |
