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.
This commit is contained in:
Ian Barwick
2016-09-19 21:24:49 +09:00
parent 2c55accbdd
commit 036c59526a

View File

@@ -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,