1diff -r -U3 coreutils-8.24/lib/freadahead.c coreutils-8.24-patched/lib/freadahead.c
2--- coreutils-8.24/lib/freadahead.c	2015-06-15 23:00:37.000000000 -0600
3+++ coreutils-8.24-patched/lib/freadahead.c	2019-08-01 19:47:31.412646436 -0600
4@@ -25,7 +25,7 @@
5 size_t
6 freadahead (FILE *fp)
7 {
8-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
9+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
10   if (fp->_IO_write_ptr > fp->_IO_write_base)
11     return 0;
12   return (fp->_IO_read_end - fp->_IO_read_ptr)
13diff -r -U3 coreutils-8.24/lib/freadptr.c coreutils-8.24-patched/lib/freadptr.c
14--- coreutils-8.24/lib/freadptr.c	2015-06-15 23:00:37.000000000 -0600
15+++ coreutils-8.24-patched/lib/freadptr.c	2019-08-01 19:47:31.416646500 -0600
16@@ -29,7 +29,7 @@
17   size_t size;
18
19   /* Keep this code in sync with freadahead!  */
20-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
21+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
22   if (fp->_IO_write_ptr > fp->_IO_write_base)
23     return NULL;
24   size = fp->_IO_read_end - fp->_IO_read_ptr;
25diff -r -U3 coreutils-8.24/lib/freadseek.c coreutils-8.24-patched/lib/freadseek.c
26--- coreutils-8.24/lib/freadseek.c	2015-06-15 23:00:37.000000000 -0600
27+++ coreutils-8.24-patched/lib/freadseek.c	2019-08-01 19:47:31.416646500 -0600
28@@ -36,7 +36,7 @@
29   /* Keep this code in sync with freadptr!  */
30 #if HAVE___FREADPTRINC              /* musl libc */
31   __freadptrinc (fp, increment);
32-#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
33+#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
34   fp->_IO_read_ptr += increment;
35 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
36   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
37diff -r -U3 coreutils-8.24/lib/fseeko.c coreutils-8.24-patched/lib/fseeko.c
38--- coreutils-8.24/lib/fseeko.c	2015-06-15 23:04:31.000000000 -0600
39+++ coreutils-8.24-patched/lib/fseeko.c	2019-08-01 19:47:31.416646500 -0600
40@@ -47,7 +47,7 @@
41 #endif
42
43   /* These tests are based on fpurge.c.  */
44-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
45+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
46   if (fp->_IO_read_end == fp->_IO_read_ptr
47       && fp->_IO_write_ptr == fp->_IO_write_base
48       && fp->_IO_save_base == NULL)
49diff -r -U3 coreutils-8.24/lib/fseterr.c coreutils-8.24-patched/lib/fseterr.c
50--- coreutils-8.24/lib/fseterr.c	2015-06-15 23:00:37.000000000 -0600
51+++ coreutils-8.24-patched/lib/fseterr.c	2019-08-01 19:47:31.416646500 -0600
52@@ -29,7 +29,7 @@
53   /* Most systems provide FILE as a struct and the necessary bitmask in
54      <stdio.h>, because they need it for implementing getc() and putc() as
55      fast macros.  */
56-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
57+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
58   fp->_flags |= _IO_ERR_SEEN;
59 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
60   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
61diff -r -U3 coreutils-8.24/lib/mountlist.c coreutils-8.24-patched/lib/mountlist.c
62--- coreutils-8.24/lib/mountlist.c	2015-07-01 09:08:30.000000000 -0600
63+++ coreutils-8.24-patched/lib/mountlist.c	2019-08-01 19:49:22.354401380 -0600
64@@ -24,6 +24,7 @@
65 #include <stdlib.h>
66 #include <string.h>
67 #include <stdint.h>
68+#include <sys/sysmacros.h>
69
70 #include "xalloc.h"
71
72diff -r -U3 coreutils-8.24/lib/stdio-impl.h coreutils-8.24-patched/lib/stdio-impl.h
73--- coreutils-8.24/lib/stdio-impl.h	2015-06-15 23:00:37.000000000 -0600
74+++ coreutils-8.24-patched/lib/stdio-impl.h	2019-08-01 19:47:31.416646500 -0600
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