summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
committerJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
commitdd3394742b3e2e01f403b1c1b41ed39273b2212e (patch)
tree5fed86738b0d518989679f3194f896fc9fcebbe2 /iconv
parent9b0cdd693e7f54fd35fd58931b940efe6ccb88cd (diff)
downloadglibc-dd3394742b3e2e01f403b1c1b41ed39273b2212e.tar.gz
glibc-dd3394742b3e2e01f403b1c1b41ed39273b2212e.tar.xz
glibc-dd3394742b3e2e01f403b1c1b41ed39273b2212e.zip
Updated to fedora-glibc-20070825T1839
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/iconv/gconv.c b/iconv/gconv.c
index cd43d3d6fb..1b64455537 100644
--- a/iconv/gconv.c
+++ b/iconv/gconv.c
@@ -1,6 +1,6 @@
 /* Convert characters in input buffer using conversion descriptor to
    output buffer.
-   Copyright (C) 1997-2001, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997-2001, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -55,11 +55,19 @@ __gconv (__gconv_t cd, const unsigned char **inbuf,
 #endif
 
   if (inbuf == NULL || *inbuf == NULL)
-    /* We just flush.  */
-    result = DL_CALL_FCT (fct,
-			  (cd->__steps, cd->__data, NULL, NULL, NULL,
-			   irreversible,
-			   cd->__data[last_step].__outbuf == NULL ? 2 : 1, 0));
+    {
+      /* We just flush.  */
+      result = DL_CALL_FCT (fct,
+			    (cd->__steps, cd->__data, NULL, NULL, NULL,
+			     irreversible,
+			     cd->__data[last_step].__outbuf == NULL ? 2 : 1,
+			     0));
+
+      /* If the flush was successful clear the rest of the state.  */
+      if (result == __GCONV_OK)
+	for (size_t cnt = 0; cnt <= last_step; ++cnt)
+	  cd->__data[cnt].__invocation_counter = 0;
+    }
   else
     {
       const unsigned char *last_start;