about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2024-09-05 20:08:10 +0000
committerJoseph Myers <josmyers@redhat.com>2024-09-05 20:08:10 +0000
commite44ca1c085b3bd41266c882ea1cb0fd436231635 (patch)
tree16652486b6f9ec07e8bf584ee95a2915b0dc3caf /stdio-common
parentcc3e743fc09ee6fca45767629df9cbcbe1feba82 (diff)
downloadglibc-e44ca1c085b3bd41266c882ea1cb0fd436231635.tar.gz
glibc-e44ca1c085b3bd41266c882ea1cb0fd436231635.tar.xz
glibc-e44ca1c085b3bd41266c882ea1cb0fd436231635.zip
Fix freopen handling of ,ccs= (bug 23675)
As reported in bug 23675 and shown up in the recently added tests of
different cases of freopen (relevant part of the test currently
conditioned under #if 0 to avoid a failure resulting from this bug),
freopen wrongly forces the stream to unoriented even when a mode with
,ccs= is specified, though such a mode is supposed to result in a
wide-oriented stream.  Move the clearing of _mode to before the actual
reopening occurs, so that the main fopen implementation can leave a
wide-oriented stream in the ,ccs= case.

Tested for x86_64.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tst-freopen2-main.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/stdio-common/tst-freopen2-main.c b/stdio-common/tst-freopen2-main.c
index 5dad41c76b..74c3125fca 100644
--- a/stdio-common/tst-freopen2-main.c
+++ b/stdio-common/tst-freopen2-main.c
@@ -386,13 +386,8 @@ do_test (void)
   fp = xfopen (file2, "w,ccs=iso-8859-1");
   ret = fputws (L"\xc0\xc1", fp);
   TEST_VERIFY (ret >= 0);
-#if 0 /* Doesn't work (bug 23675).  */
   fp = FREOPEN (file1, "r,ccs=utf-8", fp);
   TEST_VERIFY_EXIT (fp != NULL);
-#else /* Works instead.  */
-  xfclose (fp);
-  fp = xfopen (file1, "r,ccs=utf-8");
-#endif
   wc = fgetwc (fp);
   TEST_COMPARE (wc, (wint_t) 0xc0);
   wc = fgetwc (fp);