summaryrefslogtreecommitdiff
path: root/src/node_process_methods.cc
diff options
context:
space:
mode:
authorgengjiawen <technicalcute@gmail.com>2019-05-01 16:18:44 +0800
committerZYSzys <zyszys98@gmail.com>2019-05-11 17:49:52 +0800
commit56ab82e9106f87512f18a5c80be6cc0a26bda66a (patch)
tree044abe4e19d50b7db8418a05b26e0b44f6df5331 /src/node_process_methods.cc
parentb49d2aad2afe25665d389c2a8d9fbd934d10ec73 (diff)
downloadandroid-node-v8-56ab82e9106f87512f18a5c80be6cc0a26bda66a.tar.gz
android-node-v8-56ab82e9106f87512f18a5c80be6cc0a26bda66a.tar.bz2
android-node-v8-56ab82e9106f87512f18a5c80be6cc0a26bda66a.zip
src: extract common macro to util.h
PR-URL: https://github.com/nodejs/node/pull/27512 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r--src/node_process_methods.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
index 1f215eddc4..a9ddd70bcb 100644
--- a/src/node_process_methods.cc
+++ b/src/node_process_methods.cc
@@ -59,13 +59,6 @@ Mutex umask_mutex;
// used in Hrtime() and Uptime() below
#define NANOS_PER_SEC 1000000000
-#ifdef _WIN32
-/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
-#define CHDIR_BUFSIZE (MAX_PATH * 4)
-#else
-#define CHDIR_BUFSIZE (PATH_MAX)
-#endif
-
static void Abort(const FunctionCallbackInfo<Value>& args) {
Abort();
}
@@ -81,7 +74,7 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
if (err) {
// Also include the original working directory, since that will usually
// be helpful information when debugging a `chdir()` failure.
- char buf[CHDIR_BUFSIZE];
+ char buf[PATH_MAX_BYTES];
size_t cwd_len = sizeof(buf);
uv_cwd(buf, &cwd_len);
return env->ThrowUVException(err, "chdir", nullptr, buf, *path);
@@ -119,7 +112,7 @@ static void CPUUsage(const FunctionCallbackInfo<Value>& args) {
static void Cwd(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(env->has_run_bootstrapping_code());
- char buf[CHDIR_BUFSIZE];
+ char buf[PATH_MAX_BYTES];
size_t cwd_len = sizeof(buf);
int err = uv_cwd(buf, &cwd_len);
if (err)