From e2789531912a5c6ab28a90387f97c52963eec08a Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Mon, 10 Feb 2020 02:23:25 +0200 Subject: [PATCH] Update win_eventlog_sink.h --- include/spdlog/sinks/win_eventlog_sink.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/spdlog/sinks/win_eventlog_sink.h b/include/spdlog/sinks/win_eventlog_sink.h index b67cfc6e..51bfca9f 100644 --- a/include/spdlog/sinks/win_eventlog_sink.h +++ b/include/spdlog/sinks/win_eventlog_sink.h @@ -137,10 +137,9 @@ public: // Get the required size, this is expected to fail with ERROR_INSUFFICIENT_BUFFER and return the token size DWORD tusize = 0; - ::GetTokenInformation(current_process_token.token_handle_, TokenUser, NULL, 0, &tusize); - if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) + if(::GetTokenInformation(current_process_token.token_handle_, TokenUser, NULL, 0, &tusize)) { - SPDLOG_THROW(win32_error("GetTokenInformation")); + SPDLOG_THROW(win32_error("GetTokenInformation should fail")); } // get user token