summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-01-30 10:14:10 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-01-30 10:14:10 -0500
commit803acbc5efde19c0acacfc7fe4990841dbf31a3e (patch)
tree638c1ed55a726fc12b05bf3ffa4422d2926aa7aa /indra/llcommon
parent27df0a84564d3a886661aae0faae74c2157cd31b (diff)
Trim trailing "\r\n" from Windows FormatMessage() string for logging.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llprocess.cpp6
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");