Skip to content
Snippets Groups Projects
Commit ee0ef989 authored by Heikki Linnakangas's avatar Heikki Linnakangas
Browse files

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.
parent 0471b013
No related branches found
No related tags found
No related merge requests found
......@@ -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(94, pager);
......@@ -253,7 +258,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, _(" \\conninfo display information about current connection\n"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment