summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2004-05-28 17:57:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:50 -0500
commit81c497b38b33f6917e2f46182c26b1ff0fcbae7d (patch)
tree1f9a0c6d08a95ae5b4e8e0d9ba43536a377d98c0
parentfe8977e12c5b01f9adc8df6b07d91131bd4f7432 (diff)
downloadsamba-81c497b38b33f6917e2f46182c26b1ff0fcbae7d.tar.gz
samba-81c497b38b33f6917e2f46182c26b1ff0fcbae7d.tar.bz2
samba-81c497b38b33f6917e2f46182c26b1ff0fcbae7d.zip
r938: on an error save the original errno before calling iconv to reset
the conversion state (This used to be commit 4a5a122b3a85c653bbf458342400f3b8a69dc615)
-rw-r--r--source3/lib/iconv.c6
1 files changed, 5 insertions, 1 deletions
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;