From c17463bcae75a9f9b7108807745ec7bb2d472514 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 12 Apr 2014 22:51:10 +0200 Subject: Filter out newlines from error messages on Windows --- win/inspircd_win32wrapper.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'win/inspircd_win32wrapper.cpp') diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index 048baf38b..7707dea0c 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -205,6 +205,11 @@ CWin32Exception::CWin32Exception() : exception() dwErrorCode = GetLastError(); if( FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), NULL) == 0 ) sprintf_s(szErrorString, _countof(szErrorString), "Error code: %u", dwErrorCode); + for (size_t i = 0; i < _countof(szErrorString); i++) + { + if ((szErrorString[i] == '\r') || (szErrorString[i] == '\n')) + szErrorString[i] = 0; + } } CWin32Exception::CWin32Exception(const CWin32Exception& other) -- cgit v1.2.3