From 07a216ca25f2c36749a2ecdb7cb6f9f349b39bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Marqu=C3=A9s?= Date: Mon, 29 Sep 2014 16:06:05 -0300 Subject: [PATCH] If the user doesn't pass the port on which the primary server is listening we have to assume it's the DEFAULT_MASTER_PORT. This was not done, so we added a check to see if it has a value that is usable, else we use DEFAULT_MASTER_PORT. --- repmgr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repmgr.c b/repmgr.c index bf9ad8b2..61a53355 100644 --- a/repmgr.c +++ b/repmgr.c @@ -288,6 +288,12 @@ main(int argc, char **argv) strncpy(runtime_options.dbname, DEFAULT_DBNAME, MAXLEN); } + /* We check that port number is not null */ + if (!runtime_options.dbname[0]) + { + strncpy(runtime_options.masterport, DEFAULT_MASTER_PORT, MAXLEN); + } + /* Read the configuration file, normally repmgr.conf */ if (!runtime_options.config_file[0]) strncpy(runtime_options.config_file, DEFAULT_CONFIG_FILE, MAXLEN);