summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/mbstowcs_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/mbstowcs_r.c')
-rw-r--r--newlib/libc/stdlib/mbstowcs_r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/mbstowcs_r.c b/newlib/libc/stdlib/mbstowcs_r.c
index 89cda0371..c6130b2bd 100644
--- a/newlib/libc/stdlib/mbstowcs_r.c
+++ b/newlib/libc/stdlib/mbstowcs_r.c
@@ -18,7 +18,10 @@ _DEFUN (_mbstowcs_r, (reent, pwcs, s, n, state),
{
bytes = _mbtowc_r (r, ptr, t, MB_CUR_MAX, state);
if (bytes < 0)
- return -1;
+ {
+ state->__count = 0;
+ return -1;
+ }
else if (bytes == 0)
return ptr - pwcs;
t += bytes;