mingw patch appears to be applied in new upstream version
[debian/gzip] / debian / patches / gnulib-4af4a4a71827c0bc5.patch
1 From 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
3 Date: Mon, 5 Mar 2018 10:56:29 -0800
4 Subject: fflush: adjust to glibc 2.28 libio.h removal
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Problem reported by Daniel P. BerrangĂ© in:
10 https://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):
25 Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
26 * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
27 Define if not already defined.
28 ---
29  ChangeLog        | 23 +++++++++++++++++++++++
30  lib/fbufmode.c   |  2 +-
31  lib/fflush.c     |  6 +++---
32  lib/fpending.c   |  2 +-
33  lib/fpurge.c     |  2 +-
34  lib/freadable.c  |  2 +-
35  lib/freadahead.c |  2 +-
36  lib/freading.c   |  2 +-
37  lib/freadptr.c   |  2 +-
38  lib/freadseek.c  |  2 +-
39  lib/fseeko.c     |  4 ++--
40  lib/fseterr.c    |  2 +-
41  lib/fwritable.c  |  2 +-
42  lib/fwriting.c   |  2 +-
43  lib/stdio-impl.h |  6 ++++++
44  15 files changed, 45 insertions(+), 16 deletions(-)
45
46 diff --git a/lib/fflush.c b/lib/fflush.c
47 index 983ade0..a6edfa1 100644
48 --- a/lib/fflush.c
49 +++ b/lib/fflush.c
50 @@ -33,7 +33,7 @@
51  #undef fflush
52  
53  
54 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
55 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
56  
57  /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
58  static void
59 @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
60  
61  #endif
62  
63 -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
64 +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
65  
66  # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
67  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
68 @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
69    if (stream == NULL || ! freading (stream))
70      return fflush (stream);
71  
72 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
73 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
74  
75    clear_ungetc_buffer_preserving_position (stream);
76  
77 diff --git a/lib/fpurge.c b/lib/fpurge.c
78 index b1d417c..3aedcc3 100644
79 --- a/lib/fpurge.c
80 +++ b/lib/fpurge.c
81 @@ -62,7 +62,7 @@ fpurge (FILE *fp)
82    /* Most systems provide FILE as a struct and the necessary bitmask in
83       <stdio.h>, because they need it for implementing getc() and putc() as
84       fast macros.  */
85 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
86 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
87    fp->_IO_read_end = fp->_IO_read_ptr;
88    fp->_IO_write_ptr = fp->_IO_write_base;
89    /* Avoid memory leak when there is an active ungetc buffer.  */
90 diff --git a/lib/freading.c b/lib/freading.c
91 index 73c28ac..c24d0c8 100644
92 --- a/lib/freading.c
93 +++ b/lib/freading.c
94 @@ -31,7 +31,7 @@ freading (FILE *fp)
95    /* Most systems provide FILE as a struct and the necessary bitmask in
96       <stdio.h>, because they need it for implementing getc() and putc() as
97       fast macros.  */
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    return ((fp->_flags & _IO_NO_WRITES) != 0
101            || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
102                && fp->_IO_read_base != NULL));
103 diff --git a/lib/fseeko.c b/lib/fseeko.c
104 index 0101ab5..193f4e8 100644
105 --- a/lib/fseeko.c
106 +++ b/lib/fseeko.c
107 @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
108  #endif
109  
110    /* These tests are based on fpurge.c.  */
111 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
112 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
113    if (fp->_IO_read_end == fp->_IO_read_ptr
114        && fp->_IO_write_ptr == fp->_IO_write_base
115        && fp->_IO_save_base == NULL)
116 @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
117            return -1;
118          }
119  
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->_flags &= ~_IO_EOF_SEEN;
123        fp->_offset = pos;
124  #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
125 diff --git a/lib/fseterr.c b/lib/fseterr.c
126 index 82649c3..adb6372 100644
127 --- a/lib/fseterr.c
128 +++ b/lib/fseterr.c
129 @@ -29,7 +29,7 @@ fseterr (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    fp->_flags |= _IO_ERR_SEEN;
136  #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
137    /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
138 diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
139 index 78d896e..05c5752 100644
140 --- a/lib/stdio-impl.h
141 +++ b/lib/stdio-impl.h
142 @@ -18,6 +18,12 @@
143     the same implementation of stdio extension API, except that some fields
144     have different naming conventions, or their access requires some casts.  */
145  
146 +/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
147 +   problem by defining it ourselves.  FIXME: Do not rely on glibc
148 +   internals.  */
149 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
150 +# define _IO_IN_BACKUP 0x100
151 +#endif
152  
153  /* BSD stdio derived implementations.  */
154  
155 -- 
156 cgit v1.0-41-gc330
157