|
|
1b8ced |
From 1831628c0630ae96a43586b2a25ca51cbdba3e53 Mon Sep 17 00:00:00 2001
|
|
|
1b8ced |
From: Paul Eggert <address@hidden>
|
|
|
1b8ced |
Date: Mon, 5 Mar 2018 10:56:29 -0800
|
|
|
1b8ced |
Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
|
|
|
1b8ced |
MIME-Version: 1.0
|
|
|
1b8ced |
Content-Type: text/plain; charset=UTF-8
|
|
|
1b8ced |
Content-Transfer-Encoding: 8bit
|
|
|
1b8ced |
|
|
|
1b8ced |
Problem reported by Daniel P. Berrangé in:
|
|
|
1b8ced |
https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
|
|
1b8ced |
* lib/fbufmode.c (fbufmode):
|
|
|
1b8ced |
* lib/fflush.c (clear_ungetc_buffer_preserving_position)
|
|
|
1b8ced |
(disable_seek_optimization, rpl_fflush):
|
|
|
1b8ced |
* lib/fpending.c (__fpending):
|
|
|
1b8ced |
* lib/fpurge.c (fpurge):
|
|
|
1b8ced |
* lib/freadable.c (freadable):
|
|
|
1b8ced |
* lib/freadahead.c (freadahead):
|
|
|
1b8ced |
* lib/freading.c (freading):
|
|
|
1b8ced |
* lib/freadptr.c (freadptr):
|
|
|
1b8ced |
* lib/freadseek.c (freadptrinc):
|
|
|
1b8ced |
* lib/fseeko.c (fseeko):
|
|
|
1b8ced |
* lib/fseterr.c (fseterr):
|
|
|
1b8ced |
* lib/fwritable.c (fwritable):
|
|
|
1b8ced |
* lib/fwriting.c (fwriting):
|
|
|
1b8ced |
Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
|
|
|
1b8ced |
* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
|
|
|
1b8ced |
Define if not already defined.
|
|
|
1b8ced |
---
|
|
|
1b8ced |
ChangeLog | 23 +++++++++++++++++++++++
|
|
|
1b8ced |
lib/fbufmode.c | 2 +-
|
|
|
1b8ced |
lib/fflush.c | 6 +++---
|
|
|
1b8ced |
lib/fpending.c | 2 +-
|
|
|
1b8ced |
lib/fpurge.c | 2 +-
|
|
|
1b8ced |
lib/freadable.c | 2 +-
|
|
|
1b8ced |
lib/freadahead.c | 2 +-
|
|
|
1b8ced |
lib/freading.c | 2 +-
|
|
|
1b8ced |
lib/freadptr.c | 2 +-
|
|
|
1b8ced |
lib/freadseek.c | 2 +-
|
|
|
1b8ced |
lib/fseeko.c | 4 ++--
|
|
|
1b8ced |
lib/fseterr.c | 2 +-
|
|
|
1b8ced |
lib/fwritable.c | 2 +-
|
|
|
1b8ced |
lib/fwriting.c | 2 +-
|
|
|
1b8ced |
lib/stdio-impl.h | 6 ++++++
|
|
|
1b8ced |
15 files changed, 45 insertions(+), 16 deletions(-)
|
|
|
1b8ced |
|
|
|
1b8ced |
diff --git a/ChangeLog b/ChangeLog
|
|
|
1b8ced |
index 667f91663..beb835670 100644
|
|
|
1b8ced |
--- a/ChangeLog
|
|
|
1b8ced |
+++ b/ChangeLog
|
|
|
1b8ced |
@@ -1,3 +1,26 @@
|
|
|
1b8ced |
+2018-03-05 Paul Eggert <address@hidden>
|
|
|
1b8ced |
+
|
|
|
1b8ced |
+ fflush: adjust to glibc 2.28 libio.h removal
|
|
|
1b8ced |
+ Problem reported by Daniel P. Berrangé in:
|
|
|
1b8ced |
+ https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
|
|
1b8ced |
+ * lib/fbufmode.c (fbufmode):
|
|
|
1b8ced |
+ * lib/fflush.c (clear_ungetc_buffer_preserving_position)
|
|
|
1b8ced |
+ (disable_seek_optimization, rpl_fflush):
|
|
|
1b8ced |
+ * lib/fpending.c (__fpending):
|
|
|
1b8ced |
+ * lib/fpurge.c (fpurge):
|
|
|
1b8ced |
+ * lib/freadable.c (freadable):
|
|
|
1b8ced |
+ * lib/freadahead.c (freadahead):
|
|
|
1b8ced |
+ * lib/freading.c (freading):
|
|
|
1b8ced |
+ * lib/freadptr.c (freadptr):
|
|
|
1b8ced |
+ * lib/freadseek.c (freadptrinc):
|
|
|
1b8ced |
+ * lib/fseeko.c (fseeko):
|
|
|
1b8ced |
+ * lib/fseterr.c (fseterr):
|
|
|
1b8ced |
+ * lib/fwritable.c (fwritable):
|
|
|
1b8ced |
+ * lib/fwriting.c (fwriting):
|
|
|
1b8ced |
+ Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
|
|
|
1b8ced |
+ * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
|
|
|
1b8ced |
+ Define if not already defined.
|
|
|
1b8ced |
+
|
|
|
1b8ced |
2018-01-07 Jim Meyering <meyering@fb.com>
|
|
|
1b8ced |
|
|
|
1b8ced |
version 1.9
|
|
|
1b8ced |
* NEWS: Record release date.
|
|
|
1b8ced |
diff --git a/lib/fflush.c b/lib/fflush.c
|
|
|
1b8ced |
index 983ade0ff..a6edfa105 100644
|
|
|
1b8ced |
--- a/lib/fflush.c
|
|
|
1b8ced |
+++ b/lib/fflush.c
|
|
|
1b8ced |
@@ -33,7 +33,7 @@
|
|
|
1b8ced |
#undef fflush
|
|
|
1b8ced |
|
|
|
1b8ced |
|
|
|
1b8ced |
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
|
|
|
1b8ced |
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
|
|
|
1b8ced |
static void
|
|
|
1b8ced |
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
|
|
|
1b8ced |
|
|
|
1b8ced |
#endif
|
|
|
1b8ced |
|
|
|
1b8ced |
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
|
|
1b8ced |
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
|
|
1b8ced |
|
|
|
1b8ced |
# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
|
|
|
1b8ced |
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
|
|
1b8ced |
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
|
|
|
1b8ced |
if (stream == NULL || ! freading (stream))
|
|
|
1b8ced |
return fflush (stream);
|
|
|
1b8ced |
|
|
|
1b8ced |
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
|
|
|
1b8ced |
clear_ungetc_buffer_preserving_position (stream);
|
|
|
1b8ced |
|
|
|
1b8ced |
diff --git a/lib/fpurge.c b/lib/fpurge.c
|
|
|
1b8ced |
index b1d417c7a..3aedcc373 100644
|
|
|
1b8ced |
--- a/lib/fpurge.c
|
|
|
1b8ced |
+++ b/lib/fpurge.c
|
|
|
1b8ced |
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
|
|
|
1b8ced |
/* Most systems provide FILE as a struct and the necessary bitmask in
|
|
|
1b8ced |
<stdio.h>, because they need it for implementing getc() and putc() as
|
|
|
1b8ced |
fast macros. */
|
|
|
1b8ced |
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
fp->_IO_read_end = fp->_IO_read_ptr;
|
|
|
1b8ced |
fp->_IO_write_ptr = fp->_IO_write_base;
|
|
|
1b8ced |
/* Avoid memory leak when there is an active ungetc buffer. */
|
|
|
1b8ced |
diff --git a/lib/freading.c b/lib/freading.c
|
|
|
1b8ced |
index 73c28acdd..c24d0c88a 100644
|
|
|
1b8ced |
--- a/lib/freading.c
|
|
|
1b8ced |
+++ b/lib/freading.c
|
|
|
1b8ced |
@@ -31,7 +31,7 @@ freading (FILE *fp)
|
|
|
1b8ced |
/* Most systems provide FILE as a struct and the necessary bitmask in
|
|
|
1b8ced |
<stdio.h>, because they need it for implementing getc() and putc() as
|
|
|
1b8ced |
fast macros. */
|
|
|
1b8ced |
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
return ((fp->_flags & _IO_NO_WRITES) != 0
|
|
|
1b8ced |
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
|
|
|
1b8ced |
&& fp->_IO_read_base != NULL));
|
|
|
1b8ced |
diff --git a/lib/fseeko.c b/lib/fseeko.c
|
|
|
1b8ced |
index 0101ab55f..193f4e8ce 100644
|
|
|
1b8ced |
--- a/lib/fseeko.c
|
|
|
1b8ced |
+++ b/lib/fseeko.c
|
|
|
1b8ced |
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
|
|
1b8ced |
#endif
|
|
|
1b8ced |
|
|
|
1b8ced |
/* These tests are based on fpurge.c. */
|
|
|
1b8ced |
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
if (fp->_IO_read_end == fp->_IO_read_ptr
|
|
|
1b8ced |
&& fp->_IO_write_ptr == fp->_IO_write_base
|
|
|
1b8ced |
&& fp->_IO_save_base == NULL)
|
|
|
1b8ced |
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
|
|
1b8ced |
return -1;
|
|
|
1b8ced |
}
|
|
|
1b8ced |
|
|
|
1b8ced |
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
fp->_flags &= ~_IO_EOF_SEEN;
|
|
|
1b8ced |
fp->_offset = pos;
|
|
|
1b8ced |
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
|
|
1b8ced |
diff --git a/lib/fseterr.c b/lib/fseterr.c
|
|
|
1b8ced |
index 82649c3ac..adb637256 100644
|
|
|
1b8ced |
--- a/lib/fseterr.c
|
|
|
1b8ced |
+++ b/lib/fseterr.c
|
|
|
1b8ced |
@@ -29,7 +29,7 @@ fseterr (FILE *fp)
|
|
|
1b8ced |
/* Most systems provide FILE as a struct and the necessary bitmask in
|
|
|
1b8ced |
<stdio.h>, because they need it for implementing getc() and putc() as
|
|
|
1b8ced |
fast macros. */
|
|
|
1b8ced |
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
|
|
1b8ced |
fp->_flags |= _IO_ERR_SEEN;
|
|
|
1b8ced |
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
|
|
1b8ced |
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
|
|
1b8ced |
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
|
|
|
1b8ced |
index 78d896e9f..05c5752a2 100644
|
|
|
1b8ced |
--- a/lib/stdio-impl.h
|
|
|
1b8ced |
+++ b/lib/stdio-impl.h
|
|
|
1b8ced |
@@ -18,6 +18,12 @@
|
|
|
1b8ced |
the same implementation of stdio extension API, except that some fields
|
|
|
1b8ced |
have different naming conventions, or their access requires some casts. */
|
|
|
1b8ced |
|
|
|
1b8ced |
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
|
|
1b8ced |
+ problem by defining it ourselves. FIXME: Do not rely on glibc
|
|
|
1b8ced |
+ internals. */
|
|
|
1b8ced |
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
|
|
1b8ced |
+# define _IO_IN_BACKUP 0x100
|
|
|
1b8ced |
+#endif
|
|
|
1b8ced |
|
|
|
1b8ced |
/* BSD stdio derived implementations. */
|
|
|
1b8ced |
|
|
|
1b8ced |
--
|
|
|
1b8ced |
2.14.3
|
|
|
1b8ced |
|