libc/locale: Check EILSEQ return

_citrus_iconv_std_iconv_convert can return EILSEQ without setting
invlen. As a result, we should check EILSEQ in the return value or it
will incorrectly return -2

Reviewed by:    kevans
Fixes: e2030ca246 ("libc: fix c*rtomb/mbrtoc*")
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D61151
This commit is contained in:
ShengYi Hung committed 2026-11-04 15:09:36 +11:00
1 parent e89d0e74e2
commit b138d017c7
1 file changed
+1 -1
+1 -1
View File
@@ -123,7 +123,7 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
continue;
/* Illegal sequence. */
if (invlen > 0) {
if (invlen > 0 || err == EILSEQ) {
cs->srcbuf_len = 0;
errno = EILSEQ;
return ((size_t)-1);