postgresql/src
Michael Paquier 58651d8dd6 Fix compatibility thinko for fstat() on standard streams in win32stat.c
GetFinalPathNameByHandleA() cannot be used in compilation environments
where _WIN32_WINNT < 0x0600, meaning at least Windows XP used by some
buildfarm members under MinGW that Postgres still needs to support.
This was reported as a compilation warning by the buildfarm, but this is
actually worse than the report as the code would have not worked.

Instead, this switches to GetFileInformationByHandle() that is able to
fail for standard streams and succeed for redirected ones, which is what
we are looking for herein the code emulating fstat().  We also know that
it is able to work in all the environments still supported, thanks to
the existing logic of win32stat.c.

Issue introduced by 10260c7, so backpatch down to 14.

Reported-by: Justin Pryzby, via buildfarm member jacana
Author: Michael Paquier
Reviewed-by: Juan José Santamaría Flecha
Discussion: https://postgr.es/m/20211129050122.GK17618@telsasoft.com
Backpatch-through: 14
2021-11-30 09:55:50 +09:00
..
backend vacuumlazy.c: Rename dead_tuples to dead_items. 2021-11-29 09:58:01 -08:00
bin Centralize timestamp computation of control file on updates 2021-11-29 13:36:13 +09:00
common Centralize timestamp computation of control file on updates 2021-11-29 13:36:13 +09:00
fe_utils Replace unicode characters in comments with ascii 2021-11-01 22:42:49 +01:00
include Simplify declaring variables exported from libpgcommon and libpgport. 2021-11-29 11:00:00 -05:00
interfaces Remove check for accept() argument types 2021-11-09 15:35:26 +01:00
makefiles Add NO_INSTALL option to pgxs 2021-05-27 13:58:29 +02:00
pl Remove unneeded Python includes 2021-11-25 14:19:22 +01:00
port Fix compatibility thinko for fstat() on standard streams in win32stat.c 2021-11-30 09:55:50 +09:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:23 -05:00
test Replace random(), pg_erand48(), etc with a better PRNG API and algorithm. 2021-11-28 21:33:07 -05:00
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:18 -04:00
tools Replace random(), pg_erand48(), etc with a better PRNG API and algorithm. 2021-11-28 21:33:07 -05:00
tutorial doc: Prefer explicit JOIN syntax over old implicit syntax in tutorial 2021-04-08 10:51:26 +02:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Add support for LZ4 compression in pg_receivewal 2021-11-05 11:33:25 +09:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Add errhint_plural() function and make use of it 2021-03-31 09:16:25 +02:00