changeset 7254:10f2be3ea106

(iconv_alloc): Call iconv with 4xNULL arguments initially, to reset the state.
author Bruno Haible <bruno@clisp.org>
date Tue, 05 Sep 2006 11:49:36 +0000
parents 203bb805f82b
children 02d37bd4003c
files lib/iconvme.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/iconvme.c	Tue Sep 05 11:48:30 2006 +0000
+++ b/lib/iconvme.c	Tue Sep 05 11:49:36 2006 +0000
@@ -136,6 +136,13 @@
       return NULL;
     }
 
+  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
+# if defined _LIBICONV_VERSION \
+    || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+  /* Set to the initial state.  */
+  iconv (cd, NULL, NULL, NULL, NULL);
+# endif
+
 again:
   err = iconv (cd, &p, &inbytes_remaining, &outp, &outbytes_remaining);