From 55ea8790a9fdb6e1320be8e5ad84bca04dbf9a7d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 21 Aug 2007 14:43:18 +0000 Subject: [BZ #4896, BZ #4936] 2007-08-21 Ulrich Drepper [BZ #4936] * iconv/gconv.c (__gconv): If flush was successful, clear rest of the state. * iconvdata/Makefile: Add rules to build and run bug-iconv5. * iconvdata/bug-iconv5.c: New file. [BZ #4896] --- iconv/gconv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'iconv') 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 , 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; -- cgit v1.2.1