From c011a8410ec7efe6e63b10fcb15d52c7f78428cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 24 Jan 2005 19:32:40 +0000 Subject: [PATCH] Check error code before it is possibly clobbered. Spotted by w3seek. svn path=/trunk/; revision=13251 --- reactos/apps/utils/shutdown/shutdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/apps/utils/shutdown/shutdown.c b/reactos/apps/utils/shutdown/shutdown.c index 2f999898d1f..4bec4789434 100644 --- a/reactos/apps/utils/shutdown/shutdown.c +++ b/reactos/apps/utils/shutdown/shutdown.c @@ -146,7 +146,6 @@ _tmain(int argc, TCHAR *argv[]) if (! AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0) || ERROR_SUCCESS != GetLastError()) { - CloseHandle(hToken); if (ERROR_NOT_ALL_ASSIGNED == GetLastError()) { _ftprintf(stderr, _T("You are not authorized to shutdown the system\n")); @@ -155,6 +154,7 @@ _tmain(int argc, TCHAR *argv[]) { _ftprintf(stderr, _T("AdjustTokenPrivileges failed with error %d\n"), (int) GetLastError()); } + CloseHandle(hToken); exit(1); } CloseHandle(hToken);