diff --git a/lib/libc/locale/ascii.c b/lib/libc/locale/ascii.c index 1390098..e4a635d 100644 --- a/lib/libc/locale/ascii.c +++ b/lib/libc/locale/ascii.c @@ -131,6 +131,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, if (dst == NULL) { s = memchr(*src, '\0', nms); if (*s & 0x80) { + *src = s; errno = EILSEQ; return ((size_t)-1); } @@ -175,6 +176,7 @@ _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, nchr = 0; while (len-- > 0 && nwc-- > 0) { if (*s < 0 || *s > 127) { + *src = s; errno = EILSEQ; return ((size_t)-1); } diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c index ceb604f..574c25b 100644 --- a/lib/libc/locale/none.c +++ b/lib/libc/locale/none.c @@ -170,6 +170,7 @@ _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, nchr = 0; while (len-- > 0 && nwc-- > 0) { if (*s < 0 || *s > UCHAR_MAX) { + *src = s; errno = EILSEQ; return ((size_t)-1); }