Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Strip trailing \r\n from Windows error messages
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 28, 2014
1 parent 7d80ce2 commit 97b49db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compat.c
Expand Up @@ -245,6 +245,11 @@ char *openconnect__win32_strerror(DWORD err)
fail:
return strdup(_("(Error while describing error!)"));
}
nr_chars = wcslen(msgw);
if (nr_chars && msgw[nr_chars - 1] == 10)
msgw[--nr_chars] = 0;
if (nr_chars && msgw[nr_chars - 1] == 13)
msgw[--nr_chars] = 0;

nr_chars = WideCharToMultiByte(CP_UTF8, 0, msgw, -1, NULL, 0, NULL, NULL);

Expand Down

0 comments on commit 97b49db

Please sign in to comment.