diff --git a/src/jrd/os/win32/winnt.cpp b/src/jrd/os/win32/winnt.cpp index b17eb212c6..7cad3fea24 100644 --- a/src/jrd/os/win32/winnt.cpp +++ b/src/jrd/os/win32/winnt.cpp @@ -1132,16 +1132,17 @@ static bool nt_error(const TEXT* string, * to do something about it. Harumph! * **************************************/ + const DWORD lastError = GetLastError(); + Arg::StatusVector status; + status << Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << + Arg::Gds(operation); + if (lastError != ERROR_SUCCESS) + status << Arg::Windows(lastError); + if (!status_vector) - { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << - Arg::Gds(operation) << Arg::Windows(GetLastError())); - } - - ERR_build_status(status_vector, - Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << - Arg::Gds(operation) << Arg::Windows(GetLastError())); + ERR_post(status); + ERR_build_status(status_vector, status); gds__log_status(0, status_vector); return false;