diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2022-04-28 07:39:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-28 08:28:54 +0000 |
commit | 5b17ba836945f2b7cbcc77a643311f41fe7b7b6e (patch) | |
tree | 11aa849763d123d755eb0d9c30215904acdef4c2 /src/mongo/platform | |
parent | 30260c79d9e09dee6c68637f87db6c4bdf16cbfe (diff) | |
download | mongo-5b17ba836945f2b7cbcc77a643311f41fe7b7b6e.tar.gz |
SERVER-41353 replace errnoWithDescription with an API based on std::error_code
Diffstat (limited to 'src/mongo/platform')
-rw-r--r-- | src/mongo/platform/shared_library_windows.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/platform/shared_library_windows.cpp b/src/mongo/platform/shared_library_windows.cpp index 5f51c7bc4e7..2b0873d103b 100644 --- a/src/mongo/platform/shared_library_windows.cpp +++ b/src/mongo/platform/shared_library_windows.cpp @@ -44,11 +44,11 @@ namespace mongo { SharedLibrary::~SharedLibrary() { if (_handle) { if (FreeLibrary(static_cast<HMODULE>(_handle)) == 0) { - DWORD lasterror = GetLastError(); + auto ec = lastSystemError(); LOGV2_DEBUG(22614, 2, "Load library close failed: {errnoWithDescription_lasterror}", - "errnoWithDescription_lasterror"_attr = errnoWithDescription(lasterror)); + "errnoWithDescription_lasterror"_attr = errorMessage(ec)); } } } @@ -62,9 +62,10 @@ StatusWith<std::unique_ptr<SharedLibrary>> SharedLibrary::create( HMODULE handle = LoadLibraryW(full_path.c_str()); if (handle == nullptr) { + auto ec = lastSystemError(); return StatusWith<std::unique_ptr<SharedLibrary>>(ErrorCodes::InternalError, str::stream() << "Load library failed: " - << errnoWithDescription()); + << errorMessage(ec)); } return StatusWith<std::unique_ptr<SharedLibrary>>( @@ -82,7 +83,7 @@ StatusWith<void*> SharedLibrary::getSymbol(StringData name) { if (gle != ERROR_PROC_NOT_FOUND) { return StatusWith<void*>(ErrorCodes::InternalError, str::stream() << "GetProcAddress failed for symbol: " - << errnoWithDescription()); + << errorMessage(systemError(gle))); } } |