diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-07-16 09:53:45 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-07-16 09:53:45 +0000 |
commit | c83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (patch) | |
tree | d47fb1fa79c201c98e2fa7bb8dfeb6ed582beef0 /stdio-common | |
parent | 1cb6b555a864f401c8a2ba75814e982b66a62971 (diff) |
Updated to fedora-glibc-20080716T0944cvs/fedora-glibc-2_8_90-9
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/Makefile | 8 | ||||
-rw-r--r-- | stdio-common/tst-setvbuf1.c | 19 | ||||
-rw-r--r-- | stdio-common/tst-setvbuf1.expect | 2 | ||||
-rw-r--r-- | stdio-common/vfprintf.c | 11 |
4 files changed, 37 insertions, 3 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile index f8ae6f25d9..944270dafe 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 1991-2006, 2007, 2008 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -58,7 +58,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ - scanf16 scanf17 + scanf16 scanf17 tst-setvbuf1 test-srcs = tst-unbputc tst-printf @@ -130,3 +130,7 @@ bug15-ENV = LOCPATH=$(common-objpfx)localedata ifneq (,$(filter %REENTRANT, $(defines))) CPPFLAGS += -D_IO_MTSAFE_IO endif + +$(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1 + $(built-program-cmd) > $@ 2>&1 + cmp tst-setvbuf1.expect $@ diff --git a/stdio-common/tst-setvbuf1.c b/stdio-common/tst-setvbuf1.c new file mode 100644 index 0000000000..22410939c9 --- /dev/null +++ b/stdio-common/tst-setvbuf1.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +static int +do_test (void) +{ + if (setvbuf (stderr, NULL, _IOFBF, BUFSIZ) != 0) + { + puts ("Set full buffer error."); + return 1; + } + + fprintf (stderr, "Output #1 <stderr>.\n"); + printf ("Output #2 <stdout>.\n"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-setvbuf1.expect b/stdio-common/tst-setvbuf1.expect new file mode 100644 index 0000000000..281c18ca1e --- /dev/null +++ b/stdio-common/tst-setvbuf1.expect @@ -0,0 +1,2 @@ +Output #2 <stdout>. +Output #1 <stderr>. diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index ca6343c37f..714c76c3d4 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -2080,6 +2080,11 @@ _IO_helper_overflow (_IO_FILE *s, int c) { _IO_size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base, used); + if (written == 0 || written == WEOF) + return WEOF; + __wmemmove (s->_wide_data->_IO_write_base, + s->_wide_data->_IO_write_base + written, + used - written); s->_wide_data->_IO_write_ptr -= written; } #else @@ -2087,6 +2092,10 @@ _IO_helper_overflow (_IO_FILE *s, int c) if (used) { _IO_size_t written = _IO_sputn (target, s->_IO_write_base, used); + if (written == 0 || written == EOF) + return EOF; + memmove (s->_IO_write_base, s->_IO_write_base + written, + used - written); s->_IO_write_ptr -= written; } #endif |