summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/mbtowc_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/mbtowc_r.c')
-rw-r--r--newlib/libc/stdlib/mbtowc_r.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index 863404fcb..f161385ed 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -47,6 +47,14 @@ _DEFUN (__ascii_mbtowc, (r, pwc, s, n, charset, state),
if (n == 0)
return -2;
+#ifdef __CYGWIN__
+ if ((wchar_t)*t >= 0x80)
+ {
+ r->_errno = EILSEQ;
+ return -1;
+ }
+#endif
+
*pwc = (wchar_t)*t;
if (*t == '\0')