diff options
| author | Aurelien Jarno <aurelien@aurel32.net> | 2024-12-14 11:44:11 +0100 |
|---|---|---|
| committer | Aurelien Jarno <aurelien@aurel32.net> | 2024-12-16 21:33:39 +0100 |
| commit | 9a4b0eaf726f5404c6683d5c7c5e86f61c3f3fbc (patch) | |
| tree | e6fc9da348dc627495d2857d8256fc0e1613fe71 /iconv/loop.c | |
| parent | dd413a4d2f320d5c3bc43e0788919724c89b3dab (diff) | |
| download | glibc-9a4b0eaf726f5404c6683d5c7c5e86f61c3f3fbc.tar.xz glibc-9a4b0eaf726f5404c6683d5c7c5e86f61c3f3fbc.zip | |
iconv: do not report error exit with transliteration [BZ #32448]
Commit 6cbf845fcdc7 ("iconv: Preserve iconv -c error exit on invalid
inputs (bug 32046)") changed the error exit code to report an error when
an input character has been transliterated. This looks like a bug as the
moto in the iconv program is to report an error code in the same
condition as the iconv() function.
This happens because the STANDARD_TO_LOOP_ERR_HANDLER macro sets a
default value for result and later updates it if the transliteration
succeed. With the changes, setting the default value also marks the
input as illegal.
Fix that by setting up the default value of result only when the
transliteration is not used. This works because __gconv_transliterate()
calls __gconv_mark_illegal_input() to return an error. At the same time
also fix the typo outself -> ourselves.
Fixes: 6cbf845fcdc7
Resolves: BZ #32448
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'iconv/loop.c')
| -rw-r--r-- | iconv/loop.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/iconv/loop.c b/iconv/loop.c index 199fb28326..7149cec9b2 100644 --- a/iconv/loop.c +++ b/iconv/loop.c @@ -141,12 +141,13 @@ points. */ #define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \ { \ - result = __gconv_mark_illegal_input (step_data); \ - \ if (irreversible == NULL) \ - /* This means we are in call from __gconv_transliterate. In this \ - case we are not doing any error recovery outself. */ \ - break; \ + { \ + /* This means we are in call from __gconv_transliterate. In this \ + case we are not doing any error recovery ourselves. */ \ + result = __gconv_mark_illegal_input (step_data); \ + break; \ + } \ \ /* If needed, flush any conversion state, so that __gconv_transliterate \ starts with current shift state. */ \ @@ -157,6 +158,8 @@ result = __gconv_transliterate \ (step, step_data, *inptrp, \ &inptr, inend, &outptr, irreversible); \ + else \ + result = __gconv_mark_illegal_input (step_data); \ \ REINIT_PARAMS; \ \ |
