postgresql/src/bin/pg_basebackup
Michael Paquier 7fdf56b0a7 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
2018-06-25 11:20:50 +09:00
..
po Translation updates 2018-05-07 11:59:47 -04:00
t Change qr/foo$/m to qr/foo\n/m, for Perl 5.8.8. 2016-11-07 20:27:35 -05:00
.gitignore Add TAP tests for client programs 2014-04-14 21:33:46 -04:00
Makefile Update copyright for 2016 2016-01-02 13:33:40 -05:00
nls.mk Translation updates 2016-09-26 12:00:00 -04:00
pg_basebackup.c pg_basebackup: Fix comparison handling of tablespace mappings on Windows 2017-11-01 21:44:55 -04:00
pg_receivexlog.c Fix new warnings from GCC 7 2017-05-16 08:52:39 -04:00
pg_recvlogical.c Include <sys/select.h> where needed 2016-09-27 01:05:21 -03:00
receivelog.c Address set of issues with errno handling 2018-06-25 11:20:50 +09:00
receivelog.h Refactor receivelog.c parameters 2016-03-11 11:15:12 +01:00
streamutil.c Remove extra newlines after PQerrorMessage() 2018-05-05 10:53:28 -04:00
streamutil.h Update copyright for 2016 2016-01-02 13:33:40 -05:00