repmgr: escape parameter values in primary_conninfo, if required

Addresses GitHub #253.
This commit is contained in:
Ian Barwick
2016-12-21 17:07:59 +09:00
parent 062af91d36
commit 666e71a589
6 changed files with 153 additions and 7 deletions

View File

@@ -118,3 +118,21 @@ appendShellString(PQExpBuffer buf, const char *str)
appendPQExpBufferChar(buf, '\'');
}
/*
* Escape a string for use as a parameter in recovery.conf
* Caller must free returned value
*/
char *
escape_recovery_conf_value(const char *src)
{
char *result = escape_single_quotes_ascii(src);
if (!result)
{
fprintf(stderr, _("%s: out of memory\n"), progname());
exit(ERR_INTERNAL);
}
return result;
}