From 64bbb562b90bd6272988c608524da2339323f114 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 25 Aug 2019 10:46:07 +0200 Subject: [PATCH] pg_upgrade: Error out on too many command-line arguments This makes it match the behavior of other PostgreSQL programs. pg_upgrade doesn't take any non-option arguments, so these are always a mistake. --- src/bin/pg_upgrade/option.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c index e4093ed5af..6afdbeabc8 100644 --- a/src/bin/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -218,6 +218,9 @@ parseCommandLine(int argc, char *argv[]) } } + if (optind < argc) + pg_fatal("too many command-line arguments (first is \"%s\")\n", argv[optind]); + if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL) pg_fatal("could not open log file \"%s\": %m\n", INTERNAL_LOG_FILE); -- 2.22.0