| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Dereived from the test case in BZ #2337.  */ | 
 | 2 | #include <errno.h> | 
 | 3 | #include <error.h> | 
 | 4 | #include <fcntl.h> | 
 | 5 | #include <locale.h> | 
 | 6 | #include <stdio.h> | 
 | 7 | #include <stdlib.h> | 
 | 8 | #include <string.h> | 
 | 9 | #include <unistd.h> | 
 | 10 | #include <wchar.h> | 
 | 11 |  | 
 | 12 |  | 
 | 13 | static char buf[512] __attribute__ ((aligned (4096))); | 
 | 14 |  | 
 | 15 |  | 
 | 16 | static int | 
 | 17 | do_test (void) | 
 | 18 | { | 
 | 19 |   setlocale (LC_ALL, "de_DE.UTF-8"); | 
 | 20 |  | 
 | 21 |   FILE *fp = fdopen (dup (STDOUT_FILENO), "a"); | 
 | 22 |   if (fp == NULL) | 
 | 23 |     error (EXIT_FAILURE, errno, "fdopen(,\"a\")"); | 
 | 24 |  | 
 | 25 |   setvbuf (fp, buf, _IOFBF, sizeof (buf)); | 
 | 26 |  | 
 | 27 |   /* fwprintf to unbuffered stream.   */ | 
 | 28 |   fwprintf (fp, L"hello.\n"); | 
 | 29 |  | 
 | 30 |   fclose (fp); | 
 | 31 |  | 
 | 32 |   /* touch my buffer */ | 
 | 33 |   buf[45] = 'a'; | 
 | 34 |  | 
 | 35 |   return 0; | 
 | 36 | } | 
 | 37 |  | 
 | 38 | #define TEST_FUNCTION do_test () | 
 | 39 | #include "../test-skeleton.c" |