diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index fa1f07b3f3e9a36a8830c2bd6f5ef00bbd902e01..d2e184237462eb81db949a82d4b494c31f110e79 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -1092,7 +1092,7 @@ RestoreSlotFromDisk(const char *name)
 
 	elog(DEBUG1, "restoring replication slot from \"%s\"", path);
 
-	fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
+	fd = OpenTransientFile(path, O_RDWR | PG_BINARY, 0);
 
 	/*
 	 * We do not need to handle this as we are rename()ing the directory into