mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-24 23:56:29 +00:00
Consolidate connection closure calls
This commit is contained in:
15
dbutils.c
15
dbutils.c
@@ -311,6 +311,21 @@ is_superuser_connection(PGconn *conn, t_connection_user *userinfo)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
close_connection(PGconn **conn)
|
||||
{
|
||||
if (*conn == NULL)
|
||||
return;
|
||||
|
||||
if (PQstatus(*conn) == CONNECTION_OK)
|
||||
{
|
||||
PQfinish(*conn);
|
||||
}
|
||||
|
||||
*conn = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* =============================== */
|
||||
/* conninfo manipulation functions */
|
||||
/* =============================== */
|
||||
|
||||
Reference in New Issue
Block a user