From 036c59526aed568118acef566914df73b78517fa Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 19 Sep 2016 21:24:49 +0900 Subject: [PATCH] repmgr: in switchover mode, prevent checks for local config file if not provided In switchover mode, if no remote repmgr config file is provided with `-C`, repmgr attempts to look for a file with the same path as the local file (provided with `-f/--config-file`). However if this was not specified, repmgr would execute `ls` with an empty filepath on the remote host, which appeared to succeed, causing subsequent remote repmgr command executions to fail as a blank value was provided for `-f/--config-file`. Fixes GitHub #229. --- repmgr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repmgr.c b/repmgr.c index 98822ee5..09971b81 100644 --- a/repmgr.c +++ b/repmgr.c @@ -4003,6 +4003,13 @@ do_standby_switchover(void) for(i = 0; config_paths[i] && config_file_found == false; ++i) { + /* + * Don't attempt to check for an empty filename - this might be the case + * if no local configuration file was found. + */ + if (!strlen(config_paths[i])) + continue; + log_verbose(LOG_INFO, _("checking \"%s\"\n"), config_paths[i]); maxlen_snprintf(command,