0b26f7
commit 9995d0588f4f9adc68419224d2b3698e2ca4f77e
0b26f7
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
0b26f7
Date:   Tue Aug 3 21:10:29 2021 +0530
0b26f7
0b26f7
    iconv_charmap: Close output file when done
0b26f7
    
0b26f7
    Reviewed-by: Arjun Shankar <arjun@redhat.com>
0b26f7
    (cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)
0b26f7
0b26f7
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
0b26f7
index e2d53fee3cbfbb7a..a8b6b56124909f6c 100644
0b26f7
--- a/iconv/iconv_charmap.c
0b26f7
+++ b/iconv/iconv_charmap.c
0b26f7
@@ -234,6 +234,8 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
0b26f7
     while (++remaining < argc);
0b26f7
 
0b26f7
   /* All done.  */
0b26f7
+  if (output != stdout)
0b26f7
+    fclose (output);
0b26f7
   free_table (cvtbl);
0b26f7
   return status;
0b26f7
 }