diff options
author | Saúl Ibarra Corretgé <saghul@gmail.com> | 2014-03-02 23:18:26 +0100 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-03-10 17:01:47 -0700 |
commit | d2f2a32b897840d91cf240830ad5cf5f0e33a0c8 (patch) | |
tree | e7f4fc291e9961752235e3e8d7a92438d290594c /src/node.cc | |
parent | e92d35d80be6e193cb547e94c6fbf3654542dbaa (diff) | |
download | node-new-d2f2a32b897840d91cf240830ad5cf5f0e33a0c8.tar.gz |
src: adapt to API change in uv_cwd
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/node.cc b/src/node.cc index 6accd4b5f2..6c7eaf3d2d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1541,19 +1541,21 @@ static void Cwd(const FunctionCallbackInfo<Value>& args) { HandleScope scope(env->isolate()); #ifdef _WIN32 /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ - char buf[MAX_PATH * 4 + 1]; + char buf[MAX_PATH * 4]; #else - char buf[PATH_MAX + 1]; + char buf[PATH_MAX]; #endif - int err = uv_cwd(buf, ARRAY_SIZE(buf) - 1); + size_t cwd_len = sizeof(buf); + int err = uv_cwd(buf, &cwd_len); if (err) { return env->ThrowUVException(err, "uv_cwd"); } - buf[ARRAY_SIZE(buf) - 1] = '\0'; - Local<String> cwd = String::NewFromUtf8(env->isolate(), buf); - + Local<String> cwd = String::NewFromUtf8(env->isolate(), + buf, + String::kNormalString, + cwd_len); args.GetReturnValue().Set(cwd); } |