Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4a4241e

Browse files
committed
Remove redundant getenv() for PGUSER, in psql help.
Previously psql obtained the value of PGUSER twice to display a default user in its help message. Author: Kota Miyake Reviewed-by: Nitin Jadhav, Fujii Masao Discussion: https://postgr.es/m/2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com
1 parent 85d94c5 commit 4a4241e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/bin/psql/help.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,7 @@ usage(unsigned short int pager)
134134
fprintf(output, _(" -p, --port=PORT database server port (default: \"%s\")\n"),
135135
env ? env : DEF_PGPORT_STR);
136136
/* Display default user */
137-
env = getenv("PGUSER");
138-
if (!env)
139-
env = user;
140-
fprintf(output, _(" -U, --username=USERNAME database user name (default: \"%s\")\n"), env);
137+
fprintf(output, _(" -U, --username=USERNAME database user name (default: \"%s\")\n"), user);
141138
fprintf(output, _(" -w, --no-password never prompt for password\n"));
142139
fprintf(output, _(" -W, --password force password prompt (should happen automatically)\n"));
143140

0 commit comments

Comments
 (0)