]> Savannah Git Hosting - gnulib.git/commitdiff
(iconv_alloc): Call iconv with 4xNULL arguments initially, to reset the state.
authorBruno Haible <bruno@clisp.org>
Tue, 5 Sep 2006 11:49:36 +0000 (11:49 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 5 Sep 2006 11:49:36 +0000 (11:49 +0000)
lib/iconvme.c

index 394d1a4438849dfe11b5267a67dc4a93a1a540d7..5bf359f4f4365829ec44d5fb55e73289e4f50c75 100644 (file)
@@ -136,6 +136,13 @@ iconv_alloc (iconv_t cd, const char *str)
       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);