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 <dj@redhat.com>
This commit is contained in:
Florian Weimer 2024-09-20 13:10:54 +02:00
parent 8ef3cff9d1
commit 75819cdd29
2 changed files with 7 additions and 1 deletions

View File

@ -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)
{

View File

@ -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