1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

r938: on an error save the original errno before calling iconv to reset

the conversion state
(This used to be commit 4a5a122b3a)
This commit is contained in:
Herb Lewis 2004-05-28 17:57:18 +00:00 committed by Gerald (Jerry) Carter
parent fe8977e12c
commit 81c497b38b

View File

@ -129,7 +129,11 @@ static size_t sys_iconv(void *cd,
size_t ret = iconv((iconv_t)cd,
inbuf, inbytesleft,
outbuf, outbytesleft);
if (ret == (size_t)-1) iconv(cd, NULL, NULL, NULL, NULL);
if (ret == (size_t)-1) {
int saved_errno = errno;
iconv(cd, NULL, NULL, NULL, NULL);
errno = saved_errno;
}
return ret;
#else
errno = EINVAL;