[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fclose: guarantee behavior on seekable stdin
From: |
Eric Blake |
Subject: |
[PATCH] fclose: guarantee behavior on seekable stdin |
Date: |
Fri, 6 May 2011 15:34:30 -0600 |
* 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 <address@hidden>
---
> OK, I've applied the license change. Eric, you can now let 'fclose' depend on
> 'fflush'.
Well, I didn't see it go in yet, so I pushed the same thing. Then I
followed up with this, which passes testing on libvirt.
ChangeLog | 7 +++++++
doc/posix-functions/fclose.texi | 8 ++------
modules/fclose | 2 +-
tests/test-fclose.c | 5 +----
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 49b2766..b7251e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-06 Eric Blake <address@hidden>
+
+ 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 <address@hidden>
fflush, fpurge: Relicense under LGPLv2+.
diff --git a/doc/posix-functions/fclose.texi b/doc/posix-functions/fclose.texi
index a7b5760..40a2052 100644
--- a/doc/posix-functions/fclose.texi
+++ b/doc/posix-functions/fclose.texi
@@ -4,18 +4,14 @@ fclose
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.
address@hidden itemize
-
-Portability problems fixed by Gnulib module @code{fclose}:
address@hidden
@item
On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
followed by @code{fdopen} do not return streams that can be closed by
diff --git a/modules/fclose b/modules/fclose
index ac383aa..e6493c9 100644
--- a/modules/fclose
+++ b/modules/fclose
@@ -8,6 +8,7 @@ m4/fclose.m4
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 @@ LGPLv2+
Maintainer:
Bruno Haible
-
diff --git a/tests/test-fclose.c b/tests/test-fclose.c
index d9b9406..a11eca9 100644
--- a/tests/test-fclose.c
+++ b/tests/test-fclose.c
@@ -62,9 +62,7 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
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. */
--
1.7.4.4
- gl_MODULE_INDICATOR, Eric Blake, 2011/05/04
- [PATCH 1/2] tests: allow tests to learn where a module is present, Eric Blake, 2011/05/04
- Re: gl_MODULE_INDICATOR, Bruno Haible, 2011/05/05
- Re: gl_MODULE_INDICATOR, Eric Blake, 2011/05/05
- Re: two semantics of fclose(), Bruno Haible, 2011/05/05
- Re: two semantics of fclose(), Eric Blake, 2011/05/05
- Re: two semantics of fclose(), Jim Meyering, 2011/05/06
- Re: two semantics of fclose(), Bruno Haible, 2011/05/06
- [PATCH] fclose: guarantee behavior on seekable stdin,
Eric Blake <=
- Re: [PATCH] fclose: guarantee behavior on seekable stdin, Bruno Haible, 2011/05/06
- Re: [PATCH] fclose: guarantee behavior on seekable stdin, Bruno Haible, 2011/05/07