diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-01-30 10:14:10 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-01-30 10:14:10 -0500 |
commit | 803acbc5efde19c0acacfc7fe4990841dbf31a3e (patch) | |
tree | 638c1ed55a726fc12b05bf3ffa4422d2926aa7aa /indra/llcommon/llprocess.cpp | |
parent | 27df0a84564d3a886661aae0faae74c2157cd31b (diff) |
Trim trailing "\r\n" from Windows FormatMessage() string for logging.
Diffstat (limited to 'indra/llcommon/llprocess.cpp')
-rw-r--r-- | indra/llcommon/llprocess.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 2b7a534fb3..8c0e8fe65e 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -261,11 +261,15 @@ static std::string WindowsErrorString(const std::string& operation) 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); - return STRINGIZE(operation << " failed (" << result << "): " << message); + // 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"); |