Skip to content

Commit 0a1967a

Browse files
committed
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.
1 parent d2286a9 commit 0a1967a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/bin/initdb/initdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3012,7 +3012,7 @@ main(int argc, char *argv[])
30123012
if (optind < argc)
30133013
{
30143014
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
3015-
progname, argv[optind + 1]);
3015+
progname, argv[optind]);
30163016
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
30173017
progname);
30183018
exit(1);

src/bin/scripts/clusterdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ main(int argc, char *argv[])
125125
if (optind < argc)
126126
{
127127
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
128-
progname, argv[optind + 1]);
128+
progname, argv[optind]);
129129
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
130130
exit(1);
131131
}

src/bin/scripts/reindexdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ main(int argc, char *argv[])
135135
if (optind < argc)
136136
{
137137
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
138-
progname, argv[optind + 1]);
138+
progname, argv[optind]);
139139
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
140140
exit(1);
141141
}

src/bin/scripts/vacuumdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ main(int argc, char *argv[])
149149
if (optind < argc)
150150
{
151151
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
152-
progname, argv[optind + 1]);
152+
progname, argv[optind]);
153153
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
154154
exit(1);
155155
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy