Content-Length: 279839 | pFad | http://github.com/postgrespro/postgres/commit/b04ce529fd38b1d00492d03acf896f9293b6fb28

D9 Don't pass NULL to fprintf, if not currently connected to a database. · postgrespro/postgres@b04ce52 · GitHub
Skip to content

Commit b04ce52

Browse files
committed
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.
1 parent 7ac5760 commit b04ce52

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/psql/help.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ void
161161
slashUsage(unsigned short int pager)
162162
{
163163
FILE *output;
164+
char *currdb;
165+
166+
currdb = PQdb(pset.db);
167+
if (currdb == NULL)
168+
currdb = _("none");
164169

165170
output = PageOutput(94, pager);
166171

@@ -254,7 +259,7 @@ slashUsage(unsigned short int pager)
254259
fprintf(output, _("Connection\n"));
255260
fprintf(output, _(" \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n"
256261
" connect to new database (currently \"%s\")\n"),
257-
PQdb(pset.db));
262+
currdb);
258263
fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n"));
259264
fprintf(output, _(" \\password [USERNAME] securely change the password for a user\n"));
260265
fprintf(output, _(" \\conninfo display information about current connection\n"));

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b04ce529fd38b1d00492d03acf896f9293b6fb28

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy