@@ -59,13 +59,6 @@ Mutex umask_mutex;
5959// used in Hrtime() and Uptime() below
6060#define NANOS_PER_SEC 1000000000
6161
62- #ifdef _WIN32
63- /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
64- #define CHDIR_BUFSIZE (MAX_PATH * 4 )
65- #else
66- #define CHDIR_BUFSIZE (PATH_MAX)
67- #endif
68-
6962static void Abort (const FunctionCallbackInfo<Value>& args) {
7063 Abort ();
7164}
@@ -81,7 +74,7 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
8174 if (err) {
8275 // Also include the original working directory, since that will usually
8376 // be helpful information when debugging a `chdir()` failure.
84- char buf[CHDIR_BUFSIZE ];
77+ char buf[PATH_MAX_BYTES ];
8578 size_t cwd_len = sizeof (buf);
8679 uv_cwd (buf, &cwd_len);
8780 return env->ThrowUVException (err, " chdir" , nullptr , buf, *path);
@@ -119,7 +112,7 @@ static void CPUUsage(const FunctionCallbackInfo<Value>& args) {
119112static void Cwd (const FunctionCallbackInfo<Value>& args) {
120113 Environment* env = Environment::GetCurrent (args);
121114 CHECK (env->has_run_bootstrapping_code ());
122- char buf[CHDIR_BUFSIZE ];
115+ char buf[PATH_MAX_BYTES ];
123116 size_t cwd_len = sizeof (buf);
124117 int err = uv_cwd (buf, &cwd_len);
125118 if (err)
0 commit comments