From: GNU Libc Maintainers Date: Fri, 3 Jan 2025 10:56:38 +0000 (+0100) Subject: git-iconv-Multiple-on-command-line-should-not-fail-bug-3 X-Git-Tag: archive/raspbian/2.40-5+rpi1^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=694820839cc181f6c41e1c86a8eb442f63a0f6eb;p=glibc.git git-iconv-Multiple-on-command-line-should-not-fail-bug-3 commit d8582b56d0c34f924863c21cc8642bc1b6deb29f Author: Florian Weimer Date: Fri Sep 20 13:10:54 2024 +0200 iconv: Multiple - on command line should not fail (bug 32050) Usually, the second and subsequent - return EOF immediately and do not contribute to the output, but this is not an error. Reviewed-by: DJ Delorie Gbp-Pq: Topic any Gbp-Pq: Name git-iconv-Multiple-on-command-line-should-not-fail-bug-3.patch --- diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 3e02db731..dd4bc3a59 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -287,7 +287,8 @@ conversions from `%s' and to `%s' are not supported"), ret = process_fd (cd, fd); /* Now close the file. */ - close (fd); + if (fd != STDIN_FILENO) + close (fd); if (ret != 0) { diff --git a/iconv/tst-iconv_prog-buffer.sh b/iconv/tst-iconv_prog-buffer.sh index 54ff871d3..a9c3729d9 100644 --- a/iconv/tst-iconv_prog-buffer.sh +++ b/iconv/tst-iconv_prog-buffer.sh @@ -265,6 +265,11 @@ expect_exit 1 run_iconv -o "$tmp/out" "$tmp/abc" "$tmp/0xff" "$tmp/def" expect_exit 1 run_iconv -o "$tmp/out" "$tmp/abc" - < "$tmp/0xff" "$tmp/def" ! test -e "$tmp/out" +# Listing standard input multiple times should not fail (bug 32050). + +run_iconv -o "$tmp/out" "$tmp/xy" - - "$tmp/zt" < "$tmp/abc" +expect_files xy abc zt + if $failure ; then exit 1 fi