aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication')
-rw-r--r--src/backend/replication/logical/logical.c4
-rw-r--r--src/backend/replication/slot.c3
2 files changed, 2 insertions, 5 deletions
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index 939831b5576..30baa45383a 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -244,9 +244,7 @@ CreateInitDecodingContext(char *plugin,
/* register output plugin name with slot */
SpinLockAcquire(&slot->mutex);
- strncpy(NameStr(slot->data.plugin), plugin,
- NAMEDATALEN);
- NameStr(slot->data.plugin)[NAMEDATALEN - 1] = '\0';
+ StrNCpy(NameStr(slot->data.plugin), plugin, NAMEDATALEN);
SpinLockRelease(&slot->mutex);
/*
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 5f64e494c5d..dd7ff0f99a2 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -266,8 +266,7 @@ ReplicationSlotCreate(const char *name, bool db_specific,
slot->data.persistency = persistency;
slot->data.xmin = InvalidTransactionId;
slot->effective_xmin = InvalidTransactionId;
- strncpy(NameStr(slot->data.name), name, NAMEDATALEN);
- NameStr(slot->data.name)[NAMEDATALEN - 1] = '\0';
+ StrNCpy(NameStr(slot->data.name), name, NAMEDATALEN);
slot->data.database = db_specific ? MyDatabaseId : InvalidOid;
slot->data.restart_lsn = InvalidXLogRecPtr;