From ace6e07f0e86202feb29c07a26c096e95e51b226 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 19 Sep 2018 14:25:04 -0700 Subject: [PATCH] src: initialize pid variable before goto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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()->Value(); ^ ``` PR-URL: https://github.com/nodejs/node/pull/22961 Reviewed-By: James M Snell Reviewed-By: Denys Otrishko Reviewed-By: Tobias Nießen Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung --- src/node.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 657822b68bad63..1d4db4a2cbb438 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2278,6 +2278,7 @@ static void DebugProcess(const FunctionCallbackInfo& 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."); @@ -2285,7 +2286,7 @@ static void DebugProcess(const FunctionCallbackInfo& args) { } CHECK(args[0]->IsNumber()); - DWORD pid = args[0].As()->Value(); + pid = args[0].As()->Value(); process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE |