From 9c1ed88e5fa3b5c59c084b4e23b2f80d667a687d Mon Sep 17 00:00:00 2001 From: pi1024e <49824824+pi1024e@users.noreply.github.com> Date: Tue, 3 Nov 2020 13:39:29 -0500 Subject: [PATCH] Remove unneeded variable for GetLastError(); No other usage of GetLastError has the result assigned to a variable first in this code, so it is better if we make check_user_is_admin the same in that regard. --- src/common/common.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/common.cpp b/src/common/common.cpp index 2c7d3e919d..74c4c5e6c8 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -479,7 +479,7 @@ bool check_user_is_admin() }; HANDLE hToken; - DWORD dwSize = 0, dwResult = 0; + DWORD dwSize = 0; PTOKEN_GROUPS pGroupInfo; SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY; PSID pSID = NULL; @@ -493,8 +493,7 @@ bool check_user_is_admin() // Call GetTokenInformation to get the buffer size. if (!GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize)) { - dwResult = GetLastError(); - if (dwResult != ERROR_INSUFFICIENT_BUFFER) + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { return true; } @@ -636,4 +635,4 @@ std::optional exec_and_read_output(const std::wstring_view command, exit: CancelIo(readPipe.get()); return childOutput; -} \ No newline at end of file +}