summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2022-07-19 00:06:34 +0000
committerAndres Freund2022-07-19 00:21:54 +0000
commitc290e79cf07f5784fd68e726177503a6805c28d6 (patch)
tree50294fe722ce196e00e609f822bfd6605973fe2c
parent0778eb79b1e2957743bbd577fc3d862a3dc007cf (diff)
windows: msvc: Define STDIN/OUT/ERR_FILENO.
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: [email protected] (on pgsql-packagers) Backpatch: 15-, where 76e38b37a5 came in
-rw-r--r--src/include/port/win32_msvc/unistd.h8
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