]> granicus.if.org Git - postgresql/commit
Address set of issues with errno handling
authorMichael Paquier <michael@paquier.xyz>
Mon, 25 Jun 2018 02:19:05 +0000 (11:19 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 25 Jun 2018 02:19:05 +0000 (11:19 +0900)
commit6cb3372411fd6ed8ba0f8d36ae578a2daa517c16
treed5edfa830767d98fb76b8d3561e2109ecff956cd
parent370e68ae1c0a8504a10b211a9c1d9e0ffa101259
Address set of issues with errno handling

System calls mixed up in error code paths are causing two issues which
several code paths have not correctly handled:
1) For write() calls, sometimes the system may return less bytes than
what has been written without errno being set.  Some paths were careful
enough to consider that case, and assumed that errno should be set to
ENOSPC, other calls missed that.
2) errno generated by a system call is overwritten by other system calls
which may succeed once an error code path is taken, causing what is
reported to the user to be incorrect.

This patch uses the brute-force approach of correcting all those code
paths.  Some refactoring could happen in the future, but this is let as
future work, which is not targeted for back-branches anyway.

Author: Michael Paquier
Reviewed-by: Ashutosh Sharma
Discussion: https://postgr.es/m/20180622061535.GD5215@paquier.xyz
src/backend/access/heap/rewriteheap.c
src/backend/access/transam/twophase.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/replication/basebackup.c
src/backend/replication/logical/origin.c
src/backend/replication/logical/reorderbuffer.c
src/backend/replication/logical/snapbuild.c
src/backend/replication/slot.c
src/bin/pg_basebackup/walmethods.c