changeset 14703:334032e8de74

fclose: guarantee behavior on seekable stdin * modules/fclose (Depends-on): Add fflush. * doc/posix-functions/fclose.texi (fclose): Document this. * tests/test-fclose.c (main): Make test for this unconditional. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Fri, 06 May 2011 13:01:17 -0600
parents fe82559e011f
children 0223f2067342
files ChangeLog doc/posix-functions/fclose.texi modules/fclose tests/test-fclose.c
diffstat 4 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-06  Eric Blake  <eblake@redhat.com>
+
+	fclose: guarantee behavior on seekable stdin
+	* modules/fclose (Depends-on): Add fflush.
+	* doc/posix-functions/fclose.texi (fclose): Document this.
+	* tests/test-fclose.c (main): Make test for this unconditional.
+
 2011-05-06  Bruno Haible  <bruno@clisp.org>
 
 	fflush, fpurge: Relicense under LGPLv2+.
--- a/doc/posix-functions/fclose.texi
+++ b/doc/posix-functions/fclose.texi
@@ -4,18 +4,14 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fclose.html}
 
-Gnulib module: fclose, fflush
+Gnulib module: fclose
 
-Portability problems fixed by Gnulib module @code{fclose} together with module @code{fflush}:
+Portability problems fixed by Gnulib:
 @itemize
 @item
 On some platforms, this function fails to set the file position of a
 seekable input stream to the byte after the last one actually read:
 glibc 2.13, FreeBSD.
-@end itemize
-
-Portability problems fixed by Gnulib module @code{fclose}:
-@itemize
 @item
 On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
 followed by @code{fdopen} do not return streams that can be closed by
--- a/modules/fclose
+++ b/modules/fclose
@@ -8,6 +8,7 @@
 Depends-on:
 stdio
 close           [test $REPLACE_FCLOSE = 1]
+fflush          [test $REPLACE_FCLOSE = 1]
 freading        [test $REPLACE_FCLOSE = 1]
 lseek           [test $REPLACE_FCLOSE = 1]
 
@@ -25,4 +26,3 @@
 
 Maintainer:
 Bruno Haible
-
--- a/tests/test-fclose.c
+++ b/tests/test-fclose.c
@@ -62,9 +62,7 @@
   ASSERT (errno == EBADF);
   ASSERT (lseek (fd, 0, SEEK_CUR) == 2);
 
-#if GNULIB_FFLUSH
-  /* Likewise for an input stream, but only when we know fflush works
-     on input streams.  */
+  /* Likewise for an input stream.  */
   fd2 = dup (fd);
   ASSERT (0 <= fd2);
   f = fdopen (fd2, "r");
@@ -75,7 +73,6 @@
   ASSERT (lseek (fd2, 0, SEEK_CUR) == -1);
   ASSERT (errno == EBADF);
   ASSERT (lseek (fd, 0, SEEK_CUR) == 3);
-#endif
 
   /* Test that fclose() sets errno if someone else closes the stream
      fd behind the back of stdio.  */