repmgrd: enable package to supply default PID file path

Also add documentation for packagers about paths which can be patched
as default package values.
This commit is contained in:
Ian Barwick
2018-07-13 10:26:47 +09:00
parent 8b059bc9b0
commit 388ac2f392
3 changed files with 72 additions and 9 deletions

View File

@@ -275,12 +275,22 @@ main(int argc, char **argv)
/* no pid file provided - determine location */
if (pid_file[0] == '\0')
{
const char *tmpdir = getenv("TMPDIR");
/* packagers: if feasible, patch PID file path into "package_pid_file" */
char package_pid_file[MAXPGPATH] = "";
if (!tmpdir)
tmpdir = "/tmp";
if (package_pid_file[0] != '\0')
{
maxpath_snprintf(pid_file, "%s", package_pid_file);
}
else
{
const char *tmpdir = getenv("TMPDIR");
maxpath_snprintf(pid_file, "%s/repmgrd.pid", tmpdir);
if (!tmpdir)
tmpdir = "/tmp";
maxpath_snprintf(pid_file, "%s/repmgrd.pid", tmpdir);
}
}
}
else