Skip to content

Commit

Permalink
src: initialize pid variable before goto
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
nornagon authored and targos committed Sep 21, 2018
1 parent 0140a98 commit ace6e07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2278,14 +2278,15 @@ 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.");
goto out;
}

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 |
Expand Down

0 comments on commit ace6e07

Please sign in to comment.