Skip to content

Commit a932824

Browse files
author
Amit Kapila
committed
Pass Size as a 2nd argument for snprintf() in tablesync.c.
Previously the following snprintf() wrappers: * ReplicationSlotNameForTablesync() * ReplicationOriginNameForTablesync() ... used int as a second argument of snprintf() while the actual type of it is size_t. Although it doesn't fail at present better replace it with Size for consistency with the rest of the system. Author: Aleksander Alekseev Reviewed-By: Peter Smith Discussion: https://postgr.es/m/CAHut%2BPsa8hhfSE6ozUK-ih7GkQziAVAf4f3bqiXEj2nQiu-43g%40mail.gmail.com
1 parent 6971a83 commit a932824

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/backend/replication/logical/tablesync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ copy_table(Relation rel)
11871187
*/
11881188
void
11891189
ReplicationSlotNameForTablesync(Oid suboid, Oid relid,
1190-
char *syncslotname, int szslot)
1190+
char *syncslotname, Size szslot)
11911191
{
11921192
snprintf(syncslotname, szslot, "pg_%u_sync_%u_" UINT64_FORMAT, suboid,
11931193
relid, GetSystemIdentifier());
@@ -1200,7 +1200,7 @@ ReplicationSlotNameForTablesync(Oid suboid, Oid relid,
12001200
*/
12011201
void
12021202
ReplicationOriginNameForTablesync(Oid suboid, Oid relid,
1203-
char *originname, int szorgname)
1203+
char *originname, Size szorgname)
12041204
{
12051205
snprintf(originname, szorgname, "pg_%u_%u", suboid, relid);
12061206
}

src/include/replication/slot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ extern void ReplicationSlotsDropDBSlots(Oid dboid);
218218
extern bool InvalidateObsoleteReplicationSlots(XLogSegNo oldestSegno);
219219
extern ReplicationSlot *SearchNamedReplicationSlot(const char *name, bool need_lock);
220220
extern int ReplicationSlotIndex(ReplicationSlot *slot);
221-
extern void ReplicationSlotNameForTablesync(Oid suboid, Oid relid, char *syncslotname, int szslot);
221+
extern void ReplicationSlotNameForTablesync(Oid suboid, Oid relid, char *syncslotname, Size szslot);
222222
extern void ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missing_ok);
223223

224224
extern void StartupReplicationSlots(void);

src/include/replication/worker_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker);
9393
extern int logicalrep_sync_worker_count(Oid subid);
9494

9595
extern void ReplicationOriginNameForTablesync(Oid suboid, Oid relid,
96-
char *originname, int szorgname);
96+
char *originname, Size szorgname);
9797
extern char *LogicalRepSyncTableStart(XLogRecPtr *origin_startpos);
9898

9999
extern bool AllTablesyncsReady(void);

0 commit comments

Comments
 (0)