diff --git a/src/node_credentials.cc b/src/node_credentials.cc index 765d1caba94666..c8685ac488717f 100644 --- a/src/node_credentials.cc +++ b/src/node_credentials.cc @@ -172,21 +172,29 @@ static gid_t gid_by_name(Isolate* isolate, Local value) { } static void GetUid(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); // uid_t is an uint32_t on all supported platforms. args.GetReturnValue().Set(static_cast(getuid())); } static void GetGid(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); // gid_t is an uint32_t on all supported platforms. args.GetReturnValue().Set(static_cast(getgid())); } static void GetEUid(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); // uid_t is an uint32_t on all supported platforms. args.GetReturnValue().Set(static_cast(geteuid())); } static void GetEGid(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); // gid_t is an uint32_t on all supported platforms. args.GetReturnValue().Set(static_cast(getegid())); } @@ -269,6 +277,7 @@ static void SetEUid(const FunctionCallbackInfo& args) { static void GetGroups(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); int ngroups = getgroups(0, nullptr); if (ngroups == -1) return env->ThrowErrnoException(errno, "getgroups"); diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index e53a5a7015c8e3..1f215eddc4f194 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -118,6 +118,7 @@ static void CPUUsage(const FunctionCallbackInfo& args) { static void Cwd(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); char buf[CHDIR_BUFSIZE]; size_t cwd_len = sizeof(buf); int err = uv_cwd(buf, &cwd_len); @@ -226,12 +227,13 @@ static void StopProfilerIdleNotifier(const FunctionCallbackInfo& args) { } static void Umask(const FunctionCallbackInfo& args) { - uint32_t old; - + Environment* env = Environment::GetCurrent(args); + CHECK(env->has_run_bootstrapping_code()); CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsUndefined() || args[0]->IsUint32()); Mutex::ScopedLock scoped_lock(per_process::umask_mutex); + uint32_t old; if (args[0]->IsUndefined()) { old = umask(0); umask(static_cast(old));