]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Remove redundant getenv() for PGUSER, in psql help.
authorFujii Masao <fujii@postgresql.org>
Thu, 4 Mar 2021 09:23:22 +0000 (18:23 +0900)
committerFujii Masao <fujii@postgresql.org>
Thu, 4 Mar 2021 09:23:22 +0000 (18:23 +0900)
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

src/bin/psql/help.c

index e44120bf76913d53731fc75b16439172cfca5add..daa5081eac13b7824e1f28074f9646ea8d8ff7ab 100644 (file)
@@ -134,10 +134,7 @@ usage(unsigned short int pager)
        fprintf(output, _("  -p, --port=PORT          database server port (default: \"%s\")\n"),
                        env ? env : DEF_PGPORT_STR);
        /* Display default user */
-       env = getenv("PGUSER");
-       if (!env)
-               env = user;
-       fprintf(output, _("  -U, --username=USERNAME  database user name (default: \"%s\")\n"), env);
+       fprintf(output, _("  -U, --username=USERNAME  database user name (default: \"%s\")\n"), user);
        fprintf(output, _("  -w, --no-password        never prompt for password\n"));
        fprintf(output, _("  -W, --password           force password prompt (should happen automatically)\n"));