about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-12 04:37:25 +0100
committerPetr Baudis <pasky@ucw.cz>2011-05-27 01:24:24 +0200
commit18852b24dcd132d2aaa3488638ab18c15833730f (patch)
treed7735db900c7a748cced82a13306d73132c3b2a0
parent564bc26b7954ca49de2b7f18a88aad03445de2d9 (diff)
downloadglibc-18852b24dcd132d2aaa3488638ab18c15833730f.tar.gz
glibc-18852b24dcd132d2aaa3488638ab18c15833730f.tar.xz
glibc-18852b24dcd132d2aaa3488638ab18c15833730f.zip
Report write error in addmnt even for cached streams.
(cherry picked from commit e1fb097f447a89aa69a926e45e673a52d86a6c57)
-rw-r--r--ChangeLog3
-rw-r--r--misc/mntent_r.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 20a0c49dee..ad835e65f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-05-11  Ulrich Drepper  <drepper@gmail.com>
 
+	[BZ #12625]
+	* misc/mntent_r.c (addmntent): Flush the stream after the output
+
 	[BZ #12393]
 	* elf/dl-load.c (is_trusted_path): Remove unnecessary test.
 	(is_trusted_path_normalize): Skip initial colon.  Append slash
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 9598528324..6959f0e21d 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -1,5 +1,5 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010
+   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -263,8 +263,8 @@ __addmntent (FILE *stream, const struct mntent *mnt)
 		   mntcopy.mnt_type,
 		   mntcopy.mnt_opts,
 		   mntcopy.mnt_freq,
-		   mntcopy.mnt_passno)
-	  < 0 ? 1 : 0);
+		   mntcopy.mnt_passno) < 0
+	  || fflush (stream) != 0);
 }
 weak_alias (__addmntent, addmntent)