You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/27 12:32:37 UTC

(cloudberry) 11/39: Error out on too many command-line arguments

This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 9692c28127b9d16c9398f0319617618b90936630
Author: Peter Eisentraut <pe...@eisentraut.org>
AuthorDate: Thu Aug 29 16:19:35 2019 +0200

    Error out on too many command-line arguments
    
    Fix up oid2name, pg_upgrade, and pgbench to error out on too many
    command-line arguments.  This makes it match the behavior of other
    PostgreSQL programs.
    
    Author: Peter Eisentraut, Ibrar Ahmed
    Discussion: https://www.postgresql.org/message-id/flat/f2554627-04e7-383a-ef01-ab99bb6a291c%402ndquadrant.com
    (cherry picked from commit 9684e426954921e8b2bfa367f9e6a4cbbf4ce5ff)
---
 src/bin/pgbench/pgbench.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 94451d369f..86755171d8 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -6290,6 +6290,14 @@ main(int argc, char **argv)
 		exit(1);
 	}
 
+	if (optind < argc)
+	{
+		fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
+				progname, argv[optind]);
+		fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+		exit(1);
+	}
+
 	if (is_init_mode)
 	{
 		if (benchmarking_option_set)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org