windows: msvc: Define STDIN/OUT/ERR_FILENO.
authorNathan Bossart <[email protected]>
Tue, 17 Oct 2023 21:11:13 +0000 (16:11 -0500)
committerNathan Bossart <[email protected]>
Tue, 17 Oct 2023 21:11:13 +0000 (16:11 -0500)
commit0e32652a79164965e8ef409bb84804a6e608e9ea
treeff96bd79ea8c0f0e1f2fbc05bdb0a65c7a3f008b
parentb18781c2df44c2abf18dca95b1351ff917caf5fb
windows: msvc: Define STDIN/OUT/ERR_FILENO.

This commit (c290e79cf0) was originally back-patched to v15.
Commit 97550c0711 added a new use of STDERR_FILENO, and it was
back-patched all the way to v11, thus breaking MSVC builds for v11
through v14.  Since STDERR_FILENO is now needed on older versions,
let's back-patch c290e79cf0 down to v11, too.

Here follows the original commit message describing the change:

Because they are not available we've used _fileno(stdin) in some places, but
that doesn't reliably work, because stdin might be closed. This is the
prerequisite of the subsequent commit, fixing a failure introduced in
76e38b37a5.

Author: Andres Freund <[email protected]>
Reported-By: Sandeep Thakkar <[email protected]>
Message-Id: 20220520164558[email protected] (on pgsql-packagers)
Discussion: https://postgr.es/m/20231017164517.GA613565%40nathanxps13
Backpatch-through: 11
src/include/port/win32_msvc/unistd.h