From 22c2f01d87baed6a70d22ec66b59a87273ff0a1e Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 5 May 2017 18:48:39 +0900 Subject: [PATCH] Process hostname as separate argument --- repmgr-client.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/repmgr-client.c b/repmgr-client.c index b172a4df..0b62cf70 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -595,6 +595,29 @@ main(int argc, char **argv) item_list_append(&cli_errors, command_error.data); } + /* STANDBY CLONE historically accepts the upstream hostname as an additional argument */ + if (action == STANDBY_CLONE) + { + if (optind < argc) + { + if (runtime_options.host_param_provided == true) + { + PQExpBufferData additional_host_arg; + initPQExpBuffer(&additional_host_arg); + appendPQExpBuffer(&additional_host_arg, + _("host name provided both with %s and as an extra parameter"), + runtime_options.conninfo_provided == true ? "host=" : "-h/--host"); + item_list_append(&cli_errors, additional_host_arg.data); + } + else + { + strncpy(runtime_options.host, argv[optind++], MAXLEN); + param_set(&source_conninfo, "host", runtime_options.host); + runtime_options.host_param_provided = true; + } + } + } + if (optind < argc) { PQExpBufferData too_many_args;