Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiviu Ionescu <ilg@livius.net>2022-04-21 07:29:31 +0300
committerMichaƫl Zasso <targos@protonmail.com>2022-04-28 07:56:14 +0300
commit1976284a92c661b9578828ed8c412fef8e6587bb (patch)
tree1c8604a6b2b98fc5fe84498d04c65fce1c9bd8c7 /src
parent5d15eb1a1491aee17e9d347c4376060eacb2ccb7 (diff)
src: define fs.constants.S_IWUSR & S_IRUSR for Win
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and chmod() can use them. This patch defines two aliases, so that these definintions are issued in fs.constants. fixes: https://github.com/nodejs/node/issues/41591 PR-URL: https://github.com/nodejs/node/pull/42757 Refs: https://github.com/nodejs/node/issues/41591 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_constants.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node_constants.cc b/src/node_constants.cc
index 38c8f2738b4..3269e3003ac 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -47,6 +47,16 @@
#include <dlfcn.h>
#endif
+#if defined(_WIN32)
+#include <io.h> // _S_IREAD _S_IWRITE
+#ifndef S_IRUSR
+#define S_IRUSR _S_IREAD
+#endif // S_IRUSR
+#ifndef S_IWUSR
+#define S_IWUSR _S_IWRITE
+#endif // S_IWUSR
+#endif
+
#include <cerrno>
#include <csignal>
#include <limits>