From 6740cd8374b4e9697bd126680ea373ee02c43bdc Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Thu, 22 Jul 2004 02:57:29 +0000 Subject: Return the correct value when dst == NULL and conversion has stopped after nwc dropping to zero. --- lib/libc/locale/wcsnrtombs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/locale/wcsnrtombs.c b/lib/libc/locale/wcsnrtombs.c index 6f2d5b0c88c0d..68d6b5ceae02e 100644 --- a/lib/libc/locale/wcsnrtombs.c +++ b/lib/libc/locale/wcsnrtombs.c @@ -63,11 +63,11 @@ __wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src, /* Invalid character - wcrtomb() sets errno. */ return ((size_t)-1); else if (*s == L'\0') - break; + return (nbytes + nb - 1); s++; nbytes += nb; } - return (nbytes + nb - 1); + return (nbytes); } while (len > 0 && nwc-- > 0) { -- cgit v1.3