diff --git a/lib/libc/locale/mblen.c b/lib/libc/locale/mblen.c index 8486e7173cbf..65d0aa7c478f 100644 --- a/lib/libc/locale/mblen.c +++ b/lib/libc/locale/mblen.c @@ -48,9 +48,5 @@ mblen(const char *s, size_t n) rval = __mbrtowc(NULL, s, n, &mbs); if (rval == (size_t)-1 || rval == (size_t)-2) return (-1); - if (rval > INT_MAX) { - errno = ERANGE; - return (-1); - } return ((int)rval); } diff --git a/lib/libc/locale/mbtowc.c b/lib/libc/locale/mbtowc.c index 994d243fb2c8..8ee280aa2b05 100644 --- a/lib/libc/locale/mbtowc.c +++ b/lib/libc/locale/mbtowc.c @@ -49,9 +49,5 @@ mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n) rval = __mbrtowc(pwc, s, n, &mbs); if (rval == (size_t)-1 || rval == (size_t)-2) return (-1); - if (rval > INT_MAX) { - errno = ERANGE; - return (-1); - } return ((int)rval); } diff --git a/lib/libc/locale/wctomb.c b/lib/libc/locale/wctomb.c index 6616a661e891..d9c607e69760 100644 --- a/lib/libc/locale/wctomb.c +++ b/lib/libc/locale/wctomb.c @@ -48,9 +48,5 @@ wctomb(char *s, wchar_t wchar) } if ((rval = __wcrtomb(s, wchar, &mbs)) == (size_t)-1) return (-1); - if (rval > INT_MAX) { - errno = ERANGE; - return (-1); - } return ((int)rval); }