diff options
author | Nathan Bossart <nathan@postgresql.org> | 2023-10-17 16:11:08 -0500 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2023-10-17 16:11:08 -0500 |
commit | ebc093fa6481935bfd0ead8d47c8831a1bcf3536 (patch) | |
tree | 4786a6fe079eebfc06917aa324e79737cf2b16ed | |
parent | fdf8b70a51cfdde5194b457f985dc16545c73d78 (diff) |
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 <andres@anarazel.de>
Reported-By: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
Message-Id: 20220520164558.ozb7lm6unakqzezi@alap3.anarazel.de (on pgsql-packagers)
Discussion: https://postgr.es/m/20231017164517.GA613565%40nathanxps13
Backpatch-through: 11
-rw-r--r-- | src/include/port/win32_msvc/unistd.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/port/win32_msvc/unistd.h b/src/include/port/win32_msvc/unistd.h index b63f4770a1c..b7795ba03c4 100644 --- a/src/include/port/win32_msvc/unistd.h +++ b/src/include/port/win32_msvc/unistd.h @@ -1 +1,9 @@ /* src/include/port/win32_msvc/unistd.h */ + +/* + * MSVC does not define these, nor does _fileno(stdin) etc reliably work + * (returns -1 if stdin/out/err are closed). + */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 |