diff options
| author | Graham Linden <graham@lindenlab.com> | 2019-02-28 15:44:56 -0800 |
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2019-02-28 15:44:56 -0800 |
| commit | 52566e4b333a6f91c04034a6bdcb1e9099371d12 (patch) | |
| tree | c5ed54db8fc7400e4acebed1d3f069092123bbd4 /indra/llcommon/llprocess.cpp | |
| parent | da60cc476a9586449728c5b507a5cc8354cdf611 (diff) | |
| parent | 03db2ddc9c27cf842c6185826617b0da0d2b87f5 (diff) | |
Merge
Diffstat (limited to 'indra/llcommon/llprocess.cpp')
| -rw-r--r-- | indra/llcommon/llprocess.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 5753efdc59..1fa53f322b 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -1205,30 +1205,9 @@ static LLProcess::Status interpret_status(int status) /// GetLastError()/FormatMessage() boilerplate static std::string WindowsErrorString(const std::string& operation) { - int result = GetLastError(); - - LPTSTR error_str = 0; - if (FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - result, - 0, - (LPTSTR)&error_str, - 0, - NULL) - != 0) - { - // convert from wide-char string to multi-byte string - char message[256]; - wcstombs(message, error_str, sizeof(message)); - message[sizeof(message)-1] = 0; - LocalFree(error_str); - // convert to std::string to trim trailing whitespace - std::string mbsstr(message); - mbsstr.erase(mbsstr.find_last_not_of(" \t\r\n")); - return STRINGIZE(operation << " failed (" << result << "): " << mbsstr); - } - return STRINGIZE(operation << " failed (" << result - << "), but FormatMessage() did not explain"); + auto result = GetLastError(); + return STRINGIZE(operation << " failed (" << result << "): " + << windows_message<std::string>(result)); } /***************************************************************************** |
