Minor tweaks on libpqrcv_connect(): ensure conninfo_repl[] is

correctly sized and expand comment to explain otherwise
undocumented use of replication connection parameter.
This commit is contained in:
Simon Riggs 2010-03-19 17:51:42 +00:00
parent aa36bd2039
commit 75867c528d

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.5 2010/02/26 02:00:58 momjian Exp $ * $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.6 2010/03/19 17:51:42 sriggs Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -76,7 +76,7 @@ _PG_init(void)
static bool static bool
libpqrcv_connect(char *conninfo, XLogRecPtr startpoint) libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
{ {
char conninfo_repl[MAXCONNINFO + 14]; char conninfo_repl[MAXCONNINFO + 18];
char *primary_sysid; char *primary_sysid;
char standby_sysid[32]; char standby_sysid[32];
TimeLineID primary_tli; TimeLineID primary_tli;
@ -84,7 +84,7 @@ libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
PGresult *res; PGresult *res;
char cmd[64]; char cmd[64];
/* Connect */ /* Connect using deliberately undocumented parameter: replication */
snprintf(conninfo_repl, sizeof(conninfo_repl), "%s replication=true", conninfo); snprintf(conninfo_repl, sizeof(conninfo_repl), "%s replication=true", conninfo);
streamConn = PQconnectdb(conninfo_repl); streamConn = PQconnectdb(conninfo_repl);