summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-07-22 02:57:29 +0000
committertjr <tjr@FreeBSD.org>2004-07-22 02:57:29 +0000
commit7108a0ff8a120086a5df46a4e7690e3d9999e59f (patch)
treed77aba62583eee0f9601993ff09719e728ec78ef /lib
parentc7a11c5dc270353c8f9835feae5e8c7bae388d51 (diff)
downloadFreeBSD-src-7108a0ff8a120086a5df46a4e7690e3d9999e59f.zip
FreeBSD-src-7108a0ff8a120086a5df46a4e7690e3d9999e59f.tar.gz
Return the correct value when dst == NULL and conversion has stopped after
nwc dropping to zero.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/wcsnrtombs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/locale/wcsnrtombs.c b/lib/libc/locale/wcsnrtombs.c
index 6f2d5b0..68d6b5c 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) {
OpenPOWER on IntegriCloud