aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/rewriteheap.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2018-08-05 05:32:37 +0900
committerMichael Paquier <michael@paquier.xyz>2018-08-05 05:32:37 +0900
commitafd5fde856675f54a7b5d857f7a173f9a3237b57 (patch)
treeda31bb9c247fb82b42edf8d61cbbb7c2b5ace49f /src/backend/access/heap/rewriteheap.c
parentaca22574106e05d297bd04874ffa0ccbdb768e29 (diff)
downloadpostgresql-afd5fde856675f54a7b5d857f7a173f9a3237b57.tar.gz
postgresql-afd5fde856675f54a7b5d857f7a173f9a3237b57.zip
Reset properly errno before calling write()
6cb3372 enforces errno to ENOSPC when less bytes than what is expected have been written when it is unset, though it forgot to properly reset errno before doing a system call to write(), causing errno to potentially come from a previous system call. Reported-by: Tom Lane Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/31797.1533326676@sss.pgh.pa.us
Diffstat (limited to 'src/backend/access/heap/rewriteheap.c')
-rw-r--r--src/backend/access/heap/rewriteheap.c1
1 files changed, 1 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 */