xref: /OK3568_Linux_fs/buildroot/package/dc3dd/0003-fix-for-glibc-2.28.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Fix build with glibc 2.28
2
3glibc 2.28 hides a number of internal macros that used to be visible. gnulib
4relied on these macros. Add a patch based on upstream gnulib commit
54af4a4a71827c0 (fflush: adjust to glibc 2.28 libio.h removal) to fix the
6build.
7
8Signed-off-by: Baruch Siach <baruch@tkos.co.il>
9---
10Upstream status: gnulib commit 4af4a4a7182
11
12diff -Nuar dc3dd-7.2.641.orig/lib/freadahead.c dc3dd-7.2.641/lib/freadahead.c
13--- dc3dd-7.2.641.orig/lib/freadahead.c	2012-11-06 23:42:58.000000000 +0200
14+++ dc3dd-7.2.641/lib/freadahead.c	2018-10-26 08:46:36.612492230 +0300
15@@ -24,7 +24,7 @@
16 size_t
17 freadahead (FILE *fp)
18 {
19-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
20+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
21   if (fp->_IO_write_ptr > fp->_IO_write_base)
22     return 0;
23   return (fp->_IO_read_end - fp->_IO_read_ptr)
24diff -Nuar dc3dd-7.2.641.orig/lib/freadptr.c dc3dd-7.2.641/lib/freadptr.c
25--- dc3dd-7.2.641.orig/lib/freadptr.c	2012-11-06 23:42:58.000000000 +0200
26+++ dc3dd-7.2.641/lib/freadptr.c	2018-10-26 08:36:53.965310494 +0300
27@@ -29,7 +29,7 @@
28   size_t size;
29
30   /* Keep this code in sync with freadahead!  */
31-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
32+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
33   if (fp->_IO_write_ptr > fp->_IO_write_base)
34     return NULL;
35   size = fp->_IO_read_end - fp->_IO_read_ptr;
36diff -Nuar dc3dd-7.2.641.orig/lib/freadseek.c dc3dd-7.2.641/lib/freadseek.c
37--- dc3dd-7.2.641.orig/lib/freadseek.c	2012-11-06 23:42:58.000000000 +0200
38+++ dc3dd-7.2.641/lib/freadseek.c	2018-10-26 08:49:35.387912087 +0300
39@@ -34,7 +34,7 @@
40 freadptrinc (FILE *fp, size_t increment)
41 {
42   /* Keep this code in sync with freadptr!  */
43-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
44+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
45   fp->_IO_read_ptr += increment;
46 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
47   fp_->_p += increment;
48diff -Nuar dc3dd-7.2.641.orig/lib/fseeko.c dc3dd-7.2.641/lib/fseeko.c
49--- dc3dd-7.2.641.orig/lib/fseeko.c	2012-11-06 23:42:58.000000000 +0200
50+++ dc3dd-7.2.641/lib/fseeko.c	2018-10-26 08:51:02.841583936 +0300
51@@ -44,7 +44,7 @@
52 #endif
53
54   /* These tests are based on fpurge.c.  */
55-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
56+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
57   if (fp->_IO_read_end == fp->_IO_read_ptr
58       && fp->_IO_write_ptr == fp->_IO_write_base
59       && fp->_IO_save_base == NULL)
60diff -Nuar dc3dd-7.2.641.orig/lib/fseterr.c dc3dd-7.2.641/lib/fseterr.c
61--- dc3dd-7.2.641.orig/lib/fseterr.c	2012-11-06 23:42:58.000000000 +0200
62+++ dc3dd-7.2.641/lib/fseterr.c	2018-10-26 08:47:51.209919605 +0300
63@@ -29,7 +29,7 @@
64   /* Most systems provide FILE as a struct and the necessary bitmask in
65      <stdio.h>, because they need it for implementing getc() and putc() as
66      fast macros.  */
67-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
68+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
69   fp->_flags |= _IO_ERR_SEEN;
70 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
71   fp_->_flags |= __SERR;
72diff -Nuar dc3dd-7.2.641.orig/lib/stdio-impl.h dc3dd-7.2.641/lib/stdio-impl.h
73--- dc3dd-7.2.641.orig/lib/stdio-impl.h	2012-11-06 23:42:58.000000000 +0200
74+++ dc3dd-7.2.641/lib/stdio-impl.h	2018-10-26 08:46:26.136291709 +0300
75@@ -18,6 +18,12 @@
76    the same implementation of stdio extension API, except that some fields
77    have different naming conventions, or their access requires some casts.  */
78
79+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
80+   problem by defining it ourselves.  FIXME: Do not rely on glibc
81+   internals.  */
82+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
83+# define _IO_IN_BACKUP 0x100
84+#endif
85
86 /* BSD stdio derived implementations.  */
87
88