summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier2012-05-28 12:02:09 +0000
committerMichael Paquier2012-05-28 12:04:01 +0000
commit7e2906101cad5ee98a5b7d723889dc1ad6e57b87 (patch)
tree66abc574b6a369a1fc84d408af9cc7ece8cd68ba /src
parentaca5a2b063acc39366d187899ed3a5bdc0095e0d (diff)
Fix pgxc_clean crash when no options are specified
Specifying a database or all databases is mandatory. Per report from Hitoshi Hemmi and patch from Koichi Suzuki
Diffstat (limited to 'src')
-rw-r--r--src/pgxc/bin/pgxc_clean/pgxc_clean.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pgxc/bin/pgxc_clean/pgxc_clean.c b/src/pgxc/bin/pgxc_clean/pgxc_clean.c
index 3edbc38c14..b2d862ed4c 100644
--- a/src/pgxc/bin/pgxc_clean/pgxc_clean.c
+++ b/src/pgxc/bin/pgxc_clean/pgxc_clean.c
@@ -149,6 +149,15 @@ int main(int argc, char *argv[])
parse_pgxc_clean_options(argc, argv);
/*
+ * Check missing arguments
+ */
+ if (clean_all_databases == false && head_database_names == NULL)
+ {
+ fprintf(stderr, "%s: you must specify -a or -d option.\n", progname);
+ exit(1);
+ }
+
+ /*
* Arrange my environment
*/
if (output_filename)
@@ -177,6 +186,7 @@ int main(int argc, char *argv[])
{
/* Default coordinator port */
char *pgport;
+
if ((pgport = getenv("PGPORT")) == NULL)
coordinator_port = DEF_PGPORT; /* pg_config.h */
else