summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-02-24 16:07:57 -0800
committerPetr Baudis <pasky@ucw.cz>2010-05-12 02:03:13 +0200
commita82e74eb468e899f7ebe4204eefa04a967002f77 (patch)
treeccdd00d89779e11e388e32595c249e2284496dc6
parentfae1e90fa13beb6b84454626df2933ecc0b30c66 (diff)
downloadglibc-a82e74eb468e899f7ebe4204eefa04a967002f77.tar.gz
glibc-a82e74eb468e899f7ebe4204eefa04a967002f77.tar.xz
glibc-a82e74eb468e899f7ebe4204eefa04a967002f77.zip
Fix reporting of I/O errors in *dprintf functions.
(cherry picked from commit 7ca890b88e6ab7624afb1742a9fffb37ad5b3fc3)
-rw-r--r--ChangeLog5
-rw-r--r--libio/iovdprintf.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e66e0c1ffa..674587a0b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
 2010-02-24  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11319]
+	* libio/iovdprintf.c (_IO_vdprintf): Explicitly flush stream before
+	undoing the stream because _IO_FINISH doesn't report failures.
+
 	[BZ #5553]
 	* malloc/malloc.c (public_vALLOc): Set ar_ptr when trying main_arena.
 	(public_pVALLOc): Likewise.
+	Patch by Petr Baudis.
 
 2010-02-22  Jim Meyering  <meyering@redhat.com>
 
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index edab849a44..5284ff8938 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997-2000, 2001, 2002, 2003, 2006
+/* Copyright (C) 1995, 1997-2000, 2001, 2002, 2003, 2006, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -60,6 +60,9 @@ _IO_vdprintf (d, format, arg)
 
   done = INTUSE(_IO_vfprintf) (&tmpfil.file, format, arg);
 
+  if (done != EOF && _IO_do_flush (&tmpfil.file) == EOF)
+    done = EOF;
+
   _IO_FINISH (&tmpfil.file);
 
   return done;