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