pgsql: Address set of issues with errno handling

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Address set of issues with errno handling
Date: 2018-06-25 02:23:59
Message-ID: E1fXHAd-0004R4-9B@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f53ed82b7feeb1eee7388a24aa792e1d1b33e650

Modified Files
--------------
src/backend/access/transam/twophase.c | 23 +++++++++++++++++++++++
src/backend/access/transam/xlog.c | 7 +++++++
src/backend/replication/basebackup.c | 3 +++
src/bin/pg_basebackup/receivelog.c | 16 +++++++++++++++-
4 files changed, 48 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2018-06-25 10:42:23 pgsql: Translation updates
Previous Message Bruce Momjian 2018-06-24 22:07:14 pgsql: doc: adjust order of NUMERIC arguments to match syntax