diff options
-rw-r--r-- | src/backend/access/heap/rewriteheap.c | 1 | ||||
-rw-r--r-- | src/backend/access/transam/twophase.c | 1 | ||||
-rw-r--r-- | src/backend/replication/logical/origin.c | 3 | ||||
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 1 | ||||
-rw-r--r-- | src/backend/replication/logical/snapbuild.c | 1 | ||||
-rw-r--r-- | src/backend/replication/slot.c | 1 | ||||
-rw-r--r-- | src/bin/pg_basebackup/receivelog.c | 2 |
7 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index dd03543b6b3..c8fa62daeb9 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -1164,6 +1164,7 @@ heap_xlog_logical_rewrite(XLogReaderState *r) len = xlrec->num_mappings * sizeof(LogicalRewriteMappingData); /* write out tail end of mapping file (again) */ + errno = 0; if (write(fd, data, len) != len) { /* if write didn't set errno, assume problem is no disk space */ diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index faf590b7709..25d1a0d7694 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -1577,6 +1577,7 @@ RecreateTwoPhaseFile(TransactionId xid, void *content, int len) path))); /* Write content and CRC */ + errno = 0; if (write(fd, content, len) != len) { int save_errno = errno; diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index 4ecd6a9eae0..94832a105bf 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -547,6 +547,7 @@ CheckPointReplicationOrigin(void) tmppath))); /* write magic */ + errno = 0; if ((write(tmpfd, &magic, sizeof(magic))) != sizeof(magic)) { int save_errno = errno; @@ -590,6 +591,7 @@ CheckPointReplicationOrigin(void) /* make sure we only write out a commit that's persistent */ XLogFlush(local_lsn); + errno = 0; if ((write(tmpfd, &disk_state, sizeof(disk_state))) != sizeof(disk_state)) { @@ -612,6 +614,7 @@ CheckPointReplicationOrigin(void) /* write out the CRC */ FIN_CRC32C(crc); + errno = 0; if ((write(tmpfd, &crc, sizeof(crc))) != sizeof(crc)) { int save_errno = errno; diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 3606e9ec7ff..b73ac5b9243 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2369,6 +2369,7 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn, ondisk->size = sz; + errno = 0; if (write(fd, rb->outbuf, ondisk->size) != ondisk->size) { int save_errno = errno; diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 2c96fbd5067..7a06fe086f6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1571,6 +1571,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn) ereport(ERROR, (errmsg("could not open file \"%s\": %m", path))); + errno = 0; if ((write(fd, ondisk, needed_length)) != needed_length) { int save_errno = errno; diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index a5bc452d812..b42861d6259 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -1028,6 +1028,7 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel) SnapBuildOnDiskChecksummedSize); FIN_CRC32C(cp.checksum); + errno = 0; if ((write(fd, &cp, sizeof(cp))) != sizeof(cp)) { int save_errno = errno; diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 71f3fb59b7c..fb70b204f79 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -157,6 +157,7 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, zerobuf = pg_malloc0(XLOG_BLCKSZ); for (bytes = 0; bytes < XLogSegSize; bytes += XLOG_BLCKSZ) { + errno = 0; if (write(f, zerobuf, XLOG_BLCKSZ) != XLOG_BLCKSZ) { /* if write didn't set errno, assume problem is no disk space */ @@ -1217,6 +1218,7 @@ ProcessXLogDataMsg(PGconn *conn, char *copybuf, int len, } } + errno = 0; if (write(walfile, copybuf + hdr_len + bytes_written, bytes_to_write) != bytes_to_write) |