blob: c3cdd72b64d201a06b87b8c3d5d47fbff8727dd5 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 1831628c0630ae96a43586b2a25ca51cbdba3e53 Mon Sep 17 00:00:00 2001
2From: Paul Eggert <address@hidden>
3Date: Mon, 5 Mar 2018 10:56:29 -0800
4Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Problem reported by Daniel P. Berrangé in:
10https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
11* lib/fbufmode.c (fbufmode):
12* lib/fflush.c (clear_ungetc_buffer_preserving_position)
13(disable_seek_optimization, rpl_fflush):
14* lib/fpending.c (__fpending):
15* lib/fpurge.c (fpurge):
16* lib/freadable.c (freadable):
17* lib/freadahead.c (freadahead):
18* lib/freading.c (freading):
19* lib/freadptr.c (freadptr):
20* lib/freadseek.c (freadptrinc):
21* lib/fseeko.c (fseeko):
22* lib/fseterr.c (fseterr):
23* lib/fwritable.c (fwritable):
24* lib/fwriting.c (fwriting):
25Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
26* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
27Define if not already defined.
28---
29
30Upstream-Status: Pending
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32
33 ChangeLog | 23 +++++++++++++++++++++++
34 lib/fbufmode.c | 2 +-
35 lib/fflush.c | 6 +++---
36 lib/fpending.c | 2 +-
37 lib/fpurge.c | 2 +-
38 lib/freadable.c | 2 +-
39 lib/freadahead.c | 2 +-
40 lib/freading.c | 2 +-
41 lib/freadptr.c | 2 +-
42 lib/freadseek.c | 2 +-
43 lib/fseeko.c | 4 ++--
44 lib/fseterr.c | 2 +-
45 lib/fwritable.c | 2 +-
46 lib/fwriting.c | 2 +-
47 lib/stdio-impl.h | 6 ++++++
48 15 files changed, 45 insertions(+), 16 deletions(-)
49
50Index: gzip-1.9/ChangeLog
51===================================================================
52--- gzip-1.9.orig/ChangeLog
53+++ gzip-1.9/ChangeLog
54@@ -1,3 +1,26 @@
55+2018-03-05 Paul Eggert <address@hidden>
56+
57+ fflush: adjust to glibc 2.28 libio.h removal
58+ Problem reported by Daniel P. Berrangé in:
59+ https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
60+ * lib/fbufmode.c (fbufmode):
61+ * lib/fflush.c (clear_ungetc_buffer_preserving_position)
62+ (disable_seek_optimization, rpl_fflush):
63+ * lib/fpending.c (__fpending):
64+ * lib/fpurge.c (fpurge):
65+ * lib/freadable.c (freadable):
66+ * lib/freadahead.c (freadahead):
67+ * lib/freading.c (freading):
68+ * lib/freadptr.c (freadptr):
69+ * lib/freadseek.c (freadptrinc):
70+ * lib/fseeko.c (fseeko):
71+ * lib/fseterr.c (fseterr):
72+ * lib/fwritable.c (fwritable):
73+ * lib/fwriting.c (fwriting):
74+ Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
75+ * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
76+ Define if not already defined.
77+
78 2018-01-07 Jim Meyering <meyering@fb.com>
79
80 version 1.9
81Index: gzip-1.9/lib/fflush.c
82===================================================================
83--- gzip-1.9.orig/lib/fflush.c
84+++ gzip-1.9/lib/fflush.c
85@@ -33,7 +33,7 @@
86 #undef fflush
87
88
89-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
90+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
91
92 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
93 static void
94@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
95
96 #endif
97
98-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
99+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
100
101 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
102 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
103@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
104 if (stream == NULL || ! freading (stream))
105 return fflush (stream);
106
107-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
108+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
109
110 clear_ungetc_buffer_preserving_position (stream);
111
112Index: gzip-1.9/lib/fpurge.c
113===================================================================
114--- gzip-1.9.orig/lib/fpurge.c
115+++ gzip-1.9/lib/fpurge.c
116@@ -62,7 +62,7 @@ fpurge (FILE *fp)
117 /* Most systems provide FILE as a struct and the necessary bitmask in
118 <stdio.h>, because they need it for implementing getc() and putc() as
119 fast macros. */
120-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
121+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
122 fp->_IO_read_end = fp->_IO_read_ptr;
123 fp->_IO_write_ptr = fp->_IO_write_base;
124 /* Avoid memory leak when there is an active ungetc buffer. */
125Index: gzip-1.9/lib/freading.c
126===================================================================
127--- gzip-1.9.orig/lib/freading.c
128+++ gzip-1.9/lib/freading.c
129@@ -31,7 +31,7 @@ freading (FILE *fp)
130 /* Most systems provide FILE as a struct and the necessary bitmask in
131 <stdio.h>, because they need it for implementing getc() and putc() as
132 fast macros. */
133-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
134+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
135 return ((fp->_flags & _IO_NO_WRITES) != 0
136 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
137 && fp->_IO_read_base != NULL));
138Index: gzip-1.9/lib/fseeko.c
139===================================================================
140--- gzip-1.9.orig/lib/fseeko.c
141+++ gzip-1.9/lib/fseeko.c
142@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
143 #endif
144
145 /* These tests are based on fpurge.c. */
146-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
147+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
148 if (fp->_IO_read_end == fp->_IO_read_ptr
149 && fp->_IO_write_ptr == fp->_IO_write_base
150 && fp->_IO_save_base == NULL)
151@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
152 return -1;
153 }
154
155-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
156+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
157 fp->_flags &= ~_IO_EOF_SEEN;
158 fp->_offset = pos;
159 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
160Index: gzip-1.9/lib/fseterr.c
161===================================================================
162--- gzip-1.9.orig/lib/fseterr.c
163+++ gzip-1.9/lib/fseterr.c
164@@ -29,7 +29,7 @@ fseterr (FILE *fp)
165 /* Most systems provide FILE as a struct and the necessary bitmask in
166 <stdio.h>, because they need it for implementing getc() and putc() as
167 fast macros. */
168-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
169+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
170 fp->_flags |= _IO_ERR_SEEN;
171 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
172 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
173Index: gzip-1.9/lib/stdio-impl.h
174===================================================================
175--- gzip-1.9.orig/lib/stdio-impl.h
176+++ gzip-1.9/lib/stdio-impl.h
177@@ -18,6 +18,12 @@
178 the same implementation of stdio extension API, except that some fields
179 have different naming conventions, or their access requires some casts. */
180
181+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
182+ problem by defining it ourselves. FIXME: Do not rely on glibc
183+ internals. */
184+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
185+# define _IO_IN_BACKUP 0x100
186+#endif
187
188 /* BSD stdio derived implementations. */
189