diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2019-02-06 15:53:14 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2019-02-06 15:53:14 -0500 |
commit | e449ad4544afc1ceb9b1bbbc0798af6faadbc760 (patch) | |
tree | 03d10afa3850c514cb864924a36aa63357b61895 /indra/llcommon/llprocess.cpp | |
parent | 2d3b805b949a294d3f298eb3d786aac777ebb51e (diff) | |
parent | 0d27cb37bfea618896b0b4c5a422880e1a882210 (diff) |
Automated merge with ssh://bitbucket.org/lindenlab/vir-fixes
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)); } /***************************************************************************** |