Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/mbtowc.c')
-rw-r--r--newlib/libc/stdlib/mbtowc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c
index 0d16f0d9d..6da735aeb 100644
--- a/newlib/libc/stdlib/mbtowc.c
+++ b/newlib/libc/stdlib/mbtowc.c
@@ -60,9 +60,15 @@ _DEFUN (mbtowc, (pwc, s, n),
size_t n)
{
#ifdef MB_CAPABLE
+ int retval = 0;
_REENT_CHECK_MISC(_REENT);
- return _mbtowc_r (_REENT, pwc, s, n, &(_REENT_MBTOWC_STATE(_REENT)));
+ retval = _mbtowc_r (_REENT, pwc, s, n, &(_REENT_MBTOWC_STATE(_REENT)));
+
+ if (retval < 0)
+ return -1;
+ else
+ return retval;
#else /* not MB_CAPABLE */
if (s == NULL)
return 0;