mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-06-01 03:39:05 +00:00
repmgrd: fix pidfile handling at shutdown
This commit is contained in:
@@ -1908,8 +1908,20 @@ repmgrd_set_pid(PGconn *conn, pid_t repmgrd_pid, const char *pidfile)
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBuffer(&query,
|
||||
"SELECT repmgr.set_repmgrd_pid(%i, '%s')",
|
||||
(int) repmgrd_pid, pidfile);
|
||||
"SELECT repmgr.set_repmgrd_pid(%i, ",
|
||||
(int) repmgrd_pid);
|
||||
|
||||
if (pidfile != NULL)
|
||||
{
|
||||
appendPQExpBuffer(&query,
|
||||
" '%s')",
|
||||
pidfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
appendPQExpBufferStr(&query,
|
||||
" '')");
|
||||
}
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
termPQExpBuffer(&query);
|
||||
|
||||
@@ -702,7 +702,7 @@ set_repmgrd_pid(PG_FUNCTION_ARGS)
|
||||
shared_state->repmgrd_pid = repmgrd_pid;
|
||||
memset(shared_state->repmgrd_pidfile, 0, MAXPGPATH);
|
||||
|
||||
if(repmgrd_pidfile != NULL)
|
||||
if (repmgrd_pidfile != NULL)
|
||||
{
|
||||
strncpy(shared_state->repmgrd_pidfile, repmgrd_pidfile, MAXPGPATH);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user