aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/locale/big5.c2
-rw-r--r--lib/libc/locale/gbk.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/locale/big5.c b/lib/libc/locale/big5.c
index 8eb4b522bc76..9e7f1f2baaf0 100644
--- a/lib/libc/locale/big5.c
+++ b/lib/libc/locale/big5.c
@@ -118,7 +118,7 @@ _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
if (n == 0 || (size_t)(len = _big5_check(*s)) > n)
/* Incomplete multibyte sequence */
return ((size_t)-2);
- if (n == 2 && s[1] == '\0') {
+ if (len == 2 && s[1] == '\0') {
errno = EILSEQ;
return ((size_t)-1);
}
diff --git a/lib/libc/locale/gbk.c b/lib/libc/locale/gbk.c
index 2038720fa09c..d2f32c19d19e 100644
--- a/lib/libc/locale/gbk.c
+++ b/lib/libc/locale/gbk.c
@@ -115,7 +115,7 @@ _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
if (n == 0 || (size_t)(len = _gbk_check(*s)) > n)
/* Incomplete multibyte sequence */
return ((size_t)-2);
- if (n == 2 && s[1] == '\0') {
+ if (len == 2 && s[1] == '\0') {
errno = EILSEQ;
return ((size_t)-1);
}