glibc/libio/tst-setvbuf1.c
Ulrich Drepper 1e88bd0f1b [BZ #2337]
2006-12-13  Ulrich Drepper  <drepper@redhat.com>
	[BZ #2337]
	* libio/Makefile (tests): Add tst-setvbuf1.
	* libio/tst-setvbuf1.c: New file.

2006-12-08  Jakub Jelinek  <jakub@redhat.com>

	[BZ #2337]
	* libio/genops.c (__uflow): Fix a typo.
	* libio/wfiledoalloc.c (_IO_wfile_doallocate): Don't stat
	nor set _IO_LINE_BUF bit here.  Size the wide buffer based on
	the narrow buffer size.

2006-11-24  Jakub Jelinek  <jakub@redhat.com>

	[BZ #2337]
	* libio/libio.h (_IO_FLAGS2_USER_WBUF): Define.
	* libio/wgenops.c (_IO_wsetb, _IO_wdefault_finish): Test and set
	_IO_FLAGS2_USER_WBUF bit in _flags2 instead of _IO_USER_BUF bit
	in _flags.
	* libio/wstrops.c (_IO_wstr_overflow, enlarge_userbuf,
	_IO_wstr_finish): Likewise.
	* libio/wmemstream.c (open_wmemstream): Likewise.
	* libio/fileops.c (_IO_new_file_close_it): Call _IO_set[bgp]
	even for wide streams.
2006-12-13 23:17:54 +00:00

40 lines
718 B
C

/* Dereived from the test case in BZ #2337. */
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wchar.h>
static char buf[512] __attribute__ ((aligned (4096)));
static int
do_test (void)
{
setlocale (LC_ALL, "de_DE.UTF-8");
FILE *fp = fdopen (dup (STDOUT_FILENO), "a");
if (fp == NULL)
error (EXIT_FAILURE, errno, "fdopen(,\"a\")");
setvbuf (fp, buf, _IOFBF, sizeof (buf));
/* fwprintf to unbuffered stream. */
fwprintf (fp, L"hello.\n");
fclose (fp);
/* touch my buffer */
buf[45] = 'a';
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"