debug: cache win32 error code before logging

the code beneath LOG_WARNING and friends is opaque, and may accidentally
replace the value of GetLastError before we have a chance to render it.
This commit is contained in:
Danny Robson 2016-04-15 15:56:51 +10:00
parent 755ba5a6a7
commit 335703b147

View File

@ -47,7 +47,8 @@ void
prepare_debugger (void)
{
if (nullptr == LoadLibrary("exchndl.dll")) {
LOG_WARNING("Emergency debugger not loaded: %s", util::win32_error::code_string ());
auto code = GetLastError ();
LOG_WARNING("Emergency debugger not loaded: %s", util::win32_error::code_string (code));
}
}