1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-19 23:22:23 +03:00

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
This commit is contained in:
Michael Paquier
2018-08-05 05:32:44 +09:00
parent 250528cec0
commit e69a3ac4a3
6 changed files with 7 additions and 0 deletions

View File

@@ -1172,6 +1172,7 @@ heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *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 */