From: Robert Haas Date: Thu, 6 Sep 2012 19:43:46 +0000 (-0400) Subject: Fix "too many arguments" messages not to index off the end of argv[]. X-Git-Tag: REL9_3_BETA1~923 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a1967a0ef01cd193d9aa212dcf54a1b1d56720e;p=postgresql Fix "too many arguments" messages not to index off the end of argv[]. This affects initdb, clusterdb, reindexdb, and vacuumdb in master and 9.2; in earlier branches, only initdb is affected. --- diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index a53760af85..824c7fa7e4 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -3012,7 +3012,7 @@ main(int argc, char *argv[]) if (optind < argc) { fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 1]); + progname, argv[optind]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index 05b726d68e..b8ac6759b4 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -125,7 +125,7 @@ main(int argc, char *argv[]) if (optind < argc) { fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 1]); + progname, argv[optind]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); } diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index 5b56656f00..d1e27bdb5f 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -135,7 +135,7 @@ main(int argc, char *argv[]) if (optind < argc) { fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 1]); + progname, argv[optind]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); } diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index fbc132caa9..0ac6ab4ed5 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -149,7 +149,7 @@ main(int argc, char *argv[]) if (optind < argc) { fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 1]); + progname, argv[optind]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); }