From 81c497b38b33f6917e2f46182c26b1ff0fcbae7d Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 28 May 2004 17:57:18 +0000 Subject: r938: on an error save the original errno before calling iconv to reset the conversion state (This used to be commit 4a5a122b3a85c653bbf458342400f3b8a69dc615) --- source3/lib/iconv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 7df73192f2..4c9ecf992e 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -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; -- cgit