From 0e6edb13c6bf63f5122459b30793a7dc3c00c1e6 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 8 May 2009 19:38:33 +0000 Subject: [PATCH] * strfuncs.cc (sys_cp_wcstombs): Set errno to 0 before converting wide char to SO/UTF-8 sequence. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/strfuncs.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 74ca18851..b887f4200 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-05-08 IWAMURO Motonori + + * strfuncs.cc (sys_cp_wcstombs): Set errno to 0 before converting + wide char to SO/UTF-8 sequence. + 2009-05-08 Corinna Vinschen * include/sys/select.h: Guard definitions with __USE_W32_SOCKETS as diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index 110fe8f16..75ca3db28 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -432,6 +432,7 @@ sys_cp_wcstombs (wctomb_p f_wctomb, char *charset, char *dst, size_t len, ASCII SO; UTF-8 representation of invalid char. */ if (bytes == -1 && *charset != 'U'/*TF-8*/) { + _REENT->_errno = 0; buf[0] = 0x0e; /* ASCII SO */ bytes = __utf8_wctomb (_REENT, buf + 1, pw, charset, &ps); if (bytes == -1)