From 3c148b71eb7204eb8ec0f9a9dc000571f0e9730f Mon Sep 17 00:00:00 2001 From: imura Date: Fri, 29 Jul 2005 13:22:37 +0000 Subject: Change API of mb_copy_t in libmchain so that netsmb can handle multibyte character share name correctly. Reviewed by: bp --- sys/netsmb/smb_subr.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sys/netsmb') diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c index 0fb48ec..b8dab57 100644 --- a/sys/netsmb/smb_subr.c +++ b/sys/netsmb/smb_subr.c @@ -319,11 +319,20 @@ smb_maperror(int eclass, int eno) } static int -smb_copy_iconv(struct mbchain *mbp, c_caddr_t src, caddr_t dst, size_t len) +smb_copy_iconv(struct mbchain *mbp, c_caddr_t src, caddr_t dst, + size_t *srclen, size_t *dstlen) { - size_t outlen = len; + int error; + size_t inlen = *srclen, outlen = *dstlen; - return iconv_conv((struct iconv_drv*)mbp->mb_udata, &src, &len, &dst, &outlen); + error = iconv_conv((struct iconv_drv*)mbp->mb_udata, &src, &inlen, + &dst, &outlen); + if (inlen != *srclen || outlen != *dstlen) { + *srclen -= inlen; + *dstlen -= outlen; + return 0; + } else + return error; } int -- cgit v1.1