diff options
Diffstat (limited to 'win32/winutil.c')
-rw-r--r-- | win32/winutil.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/winutil.c b/win32/winutil.c index 530dc4f0f6..a14416a6ce 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -24,7 +24,7 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) {/*{{{*/ - wchar_t *bufw = NULL; + wchar_t *bufw = NULL, *pw; char *buf; DWORD ret = FormatMessageW( @@ -36,6 +36,10 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) return ""; } + /* strip trailing line breaks and periods */ + for (pw = bufw + wcslen(bufw) - 1; pw >= bufw && (*pw == L'\r' || *pw == L'\n' || *pw == L'.'); pw--); + pw[1] = L'\0'; + buf = php_win32_cp_conv_w_to_any(bufw, ret, PHP_WIN32_CP_IGNORE_LEN_P); LocalFree(bufw); |