diff options
author | Jeremy Apthorp <jeremya@chromium.org> | 2018-09-19 14:25:04 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-09-20 21:10:58 +0200 |
commit | b7c1038d35cd401e95b2e9520ddc0b6d28aeff89 (patch) | |
tree | 12420e60825aa34bf72bbbf849ed67d86064f17c /src | |
parent | 676bd5f0f4a847429486610c7b4a75803667705f (diff) | |
download | android-node-v8-b7c1038d35cd401e95b2e9520ddc0b6d28aeff89.tar.gz android-node-v8-b7c1038d35cd401e95b2e9520ddc0b6d28aeff89.tar.bz2 android-node-v8-b7c1038d35cd401e95b2e9520ddc0b6d28aeff89.zip |
src: initialize pid variable before goto
This fixes an error when compiling with clang-cl on Windows:
```
src/node.cc(2437,5): error: jump from this goto statement to its label is a Microsoft extension [-Werror,-Wmicrosoft-goto]
goto out;
^
src/node.cc(2441,9): note: jump bypasses variable initialization
DWORD pid = args[0].As<Integer>()->Value();
^
```
PR-URL: https://github.com/nodejs/node/pull/22961
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node.cc b/src/node.cc index 5e43361923..cd9de349bc 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2271,6 +2271,7 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) { HANDLE mapping = nullptr; wchar_t mapping_name[32]; LPTHREAD_START_ROUTINE* handler = nullptr; + DWORD pid = 0; if (args.Length() != 1) { env->ThrowError("Invalid number of arguments."); @@ -2278,7 +2279,7 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) { } CHECK(args[0]->IsNumber()); - DWORD pid = args[0].As<Integer>()->Value(); + pid = args[0].As<Integer>()->Value(); process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | |