tools: findutils: fix compilation with glibc 2.28
[openwrt/staging/hauke.git] / tools / findutils / patches / 110-glibc-change-work-around.patch
1 Subject: Workaround change in glibc
2
3 Temporary workaround to compile with glibc 2.28, which
4 deprecated some constants
5
6 Based on the workaround made for the tools/m4 package
7
8 --- a/gl/lib/stdio-impl.h
9 +++ b/gl/lib/stdio-impl.h
10 @@ -18,6 +18,12 @@
11 the same implementation of stdio extension API, except that some fields
12 have different naming conventions, or their access requires some casts. */
13
14 +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
15 + problem by defining it ourselves. FIXME: Do not rely on glibc
16 + internals. */
17 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
18 +# define _IO_IN_BACKUP 0x100
19 +#endif
20
21 /* BSD stdio derived implementations. */
22
23 --- a/gl/lib/freadahead.c
24 +++ b/gl/lib/freadahead.c
25 @@ -25,7 +25,7 @@
26 size_t
27 freadahead (FILE *fp)
28 {
29 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
30 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
31 if (fp->_IO_write_ptr > fp->_IO_write_base)
32 return 0;
33 return (fp->_IO_read_end - fp->_IO_read_ptr)
34 --- a/gl/lib/fseeko.c
35 +++ b/gl/lib/fseeko.c
36 @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
37 #endif
38
39 /* These tests are based on fpurge.c. */
40 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
41 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
42 if (fp->_IO_read_end == fp->_IO_read_ptr
43 && fp->_IO_write_ptr == fp->_IO_write_base
44 && fp->_IO_save_base == NULL)
45 @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
46 return -1;
47 }
48
49 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
50 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
51 fp->_flags &= ~_IO_EOF_SEEN;
52 fp->_offset = pos;
53 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
54 --- a/gl/lib/fflush.c
55 +++ b/gl/lib/fflush.c
56 @@ -33,7 +33,7 @@
57 #undef fflush
58
59
60 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
61 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
62
63 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
64 static void
65 @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
66
67 #endif
68
69 -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
70 +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
71
72 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
73 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
74 @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
75 if (stream == NULL || ! freading (stream))
76 return fflush (stream);
77
78 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
79 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
80
81 clear_ungetc_buffer_preserving_position (stream);
82
83 --- a/gl/lib/freading.c
84 +++ b/gl/lib/freading.c
85 @@ -31,7 +31,7 @@ freading (FILE *fp)
86 /* Most systems provide FILE as a struct and the necessary bitmask in
87 <stdio.h>, because they need it for implementing getc() and putc() as
88 fast macros. */
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 return ((fp->_flags & _IO_NO_WRITES) != 0
92 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
93 && fp->_IO_read_base != NULL));
94 --- a/gl/lib/fpurge.c
95 +++ b/gl/lib/fpurge.c
96 @@ -62,7 +62,7 @@ fpurge (FILE *fp)
97 /* Most systems provide FILE as a struct and the necessary bitmask in
98 <stdio.h>, because they need it for implementing getc() and putc() as
99 fast macros. */
100 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
101 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
102 fp->_IO_read_end = fp->_IO_read_ptr;
103 fp->_IO_write_ptr = fp->_IO_write_base;
104 /* Avoid memory leak when there is an active ungetc buffer. */