mirror of
https://github.com/zebrajr/postgres.git
synced 2025-12-07 12:20:31 +01:00
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.
This commit is contained in:
parent
0af83bd530
commit
63b0b397c7
|
|
@ -159,6 +159,11 @@ void
|
||||||
slashUsage(unsigned short int pager)
|
slashUsage(unsigned short int pager)
|
||||||
{
|
{
|
||||||
FILE *output;
|
FILE *output;
|
||||||
|
char *currdb;
|
||||||
|
|
||||||
|
currdb = PQdb(pset.db);
|
||||||
|
if (currdb == NULL)
|
||||||
|
currdb = _("none");
|
||||||
|
|
||||||
output = PageOutput(69, pager);
|
output = PageOutput(69, pager);
|
||||||
|
|
||||||
|
|
@ -171,7 +176,7 @@ slashUsage(unsigned short int pager)
|
||||||
fprintf(output, _("General\n"));
|
fprintf(output, _("General\n"));
|
||||||
fprintf(output, _(" \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n"
|
fprintf(output, _(" \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n"
|
||||||
" connect to new database (currently \"%s\")\n"),
|
" connect to new database (currently \"%s\")\n"),
|
||||||
PQdb(pset.db));
|
currdb);
|
||||||
fprintf(output, _(" \\cd [DIR] change the current working directory\n"));
|
fprintf(output, _(" \\cd [DIR] change the current working directory\n"));
|
||||||
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
|
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
|
||||||
fprintf(output, _(" \\encoding [ENCODING]\n"
|
fprintf(output, _(" \\encoding [ENCODING]\n"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user