1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

make sure we reset the shift state on error for charsets like SJIS

(This used to be commit 42648a7aad)
This commit is contained in:
Andrew Tridgell 2001-07-05 00:04:30 +00:00
parent 6b97f76be8
commit ee3119cee6

View File

@ -62,7 +62,16 @@ size_t smb_iconv(smb_iconv_t cd,
#ifdef HAVE_NATIVE_ICONV
if (cd->cd) {
return iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft);
size_t ret;
ret = iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft);
/* if there was an error then reset the internal state,
this ensures that we don't have a shift state remaining for
character sets like SJIS */
if (ret == (size_t)-1) {
iconv(cd->cd, NULL, NULL, NULL, NULL);
}
return ret;
}
#endif