diff options
Diffstat (limited to 'meta/recipes-core/coreutils/coreutils/0002-fflush-be-more-paranoid-about-libio.h-change.patch')
-rw-r--r-- | meta/recipes-core/coreutils/coreutils/0002-fflush-be-more-paranoid-about-libio.h-change.patch | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/meta/recipes-core/coreutils/coreutils/0002-fflush-be-more-paranoid-about-libio.h-change.patch b/meta/recipes-core/coreutils/coreutils/0002-fflush-be-more-paranoid-about-libio.h-change.patch new file mode 100644 index 0000000000..8cc7d63779 --- /dev/null +++ b/meta/recipes-core/coreutils/coreutils/0002-fflush-be-more-paranoid-about-libio.h-change.patch | |||
@@ -0,0 +1,187 @@ | |||
1 | From 72a2dae68c9101d80abdce8c4e41f7e562bd2399 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= <s.mueller-klieser@phytec.de> | ||
3 | Date: Wed, 13 Mar 2019 14:09:39 +0100 | ||
4 | Subject: [PATCH 2/2] fflush: be more paranoid about libio.h change | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Backport of patch: | ||
10 | 74d9d6a293d7462dea8f83e7fc5ac792e956a0ad | ||
11 | Paul Eggert <eggert@cs.ucla.edu> | ||
12 | fflush: be more paranoid about libio.h change | ||
13 | |||
14 | Upstream-Status: Backport [master] | ||
15 | |||
16 | Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de> | ||
17 | --- | ||
18 | lib/fflush.c | 9 ++++++--- | ||
19 | lib/fpending.c | 3 ++- | ||
20 | lib/fpurge.c | 3 ++- | ||
21 | lib/freadahead.c | 3 ++- | ||
22 | lib/freading.c | 3 ++- | ||
23 | lib/freadptr.c | 3 ++- | ||
24 | lib/freadseek.c | 3 ++- | ||
25 | lib/fseeko.c | 6 ++++-- | ||
26 | lib/fseterr.c | 3 ++- | ||
27 | 9 files changed, 24 insertions(+), 12 deletions(-) | ||
28 | |||
29 | diff --git a/lib/fflush.c b/lib/fflush.c | ||
30 | index c16da5fdcf23..b69206296e9a 100644 | ||
31 | --- a/lib/fflush.c | ||
32 | +++ b/lib/fflush.c | ||
33 | @@ -33,7 +33,8 @@ | ||
34 | #undef fflush | ||
35 | |||
36 | |||
37 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
38 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
39 | +/* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
40 | |||
41 | /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ | ||
42 | static void | ||
43 | @@ -72,7 +73,8 @@ clear_ungetc_buffer (FILE *fp) | ||
44 | |||
45 | #endif | ||
46 | |||
47 | -#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) | ||
48 | +#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1) | ||
49 | +/* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
50 | |||
51 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT | ||
52 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | ||
53 | @@ -148,7 +150,8 @@ rpl_fflush (FILE *stream) | ||
54 | if (stream == NULL || ! freading (stream)) | ||
55 | return fflush (stream); | ||
56 | |||
57 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
58 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
59 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
60 | |||
61 | clear_ungetc_buffer_preserving_position (stream); | ||
62 | |||
63 | diff --git a/lib/fpending.c b/lib/fpending.c | ||
64 | index 9e21a165e220..0c3b931dba9a 100644 | ||
65 | --- a/lib/fpending.c | ||
66 | +++ b/lib/fpending.c | ||
67 | @@ -32,7 +32,8 @@ __fpending (FILE *fp) | ||
68 | /* Most systems provide FILE as a struct and the necessary bitmask in | ||
69 | <stdio.h>, because they need it for implementing getc() and putc() as | ||
70 | fast macros. */ | ||
71 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
72 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
73 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
74 | return fp->_IO_write_ptr - fp->_IO_write_base; | ||
75 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | ||
76 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | ||
77 | diff --git a/lib/fpurge.c b/lib/fpurge.c | ||
78 | index 3a160004d49d..4558ab9a0783 100644 | ||
79 | --- a/lib/fpurge.c | ||
80 | +++ b/lib/fpurge.c | ||
81 | @@ -62,7 +62,8 @@ 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_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
86 | +# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
87 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
88 | fp->_IO_read_end = fp->_IO_read_ptr; | ||
89 | fp->_IO_write_ptr = fp->_IO_write_base; | ||
90 | /* Avoid memory leak when there is an active ungetc buffer. */ | ||
91 | diff --git a/lib/freadahead.c b/lib/freadahead.c | ||
92 | index e7cb77b6722b..496686042d1e 100644 | ||
93 | --- a/lib/freadahead.c | ||
94 | +++ b/lib/freadahead.c | ||
95 | @@ -30,7 +30,8 @@ extern size_t __sreadahead (FILE *); | ||
96 | size_t | ||
97 | freadahead (FILE *fp) | ||
98 | { | ||
99 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
100 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
101 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
102 | if (fp->_IO_write_ptr > fp->_IO_write_base) | ||
103 | return 0; | ||
104 | return (fp->_IO_read_end - fp->_IO_read_ptr) | ||
105 | diff --git a/lib/freading.c b/lib/freading.c | ||
106 | index c9d33449e948..5e66df1dc7dd 100644 | ||
107 | --- a/lib/freading.c | ||
108 | +++ b/lib/freading.c | ||
109 | @@ -31,7 +31,8 @@ freading (FILE *fp) | ||
110 | /* Most systems provide FILE as a struct and the necessary bitmask in | ||
111 | <stdio.h>, because they need it for implementing getc() and putc() as | ||
112 | fast macros. */ | ||
113 | -# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
114 | +# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
115 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
116 | return ((fp->_flags & _IO_NO_WRITES) != 0 | ||
117 | || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 | ||
118 | && fp->_IO_read_base != NULL)); | ||
119 | diff --git a/lib/freadptr.c b/lib/freadptr.c | ||
120 | index aba8dd5964fc..e82b41e3f4d9 100644 | ||
121 | --- a/lib/freadptr.c | ||
122 | +++ b/lib/freadptr.c | ||
123 | @@ -29,7 +29,8 @@ freadptr (FILE *fp, size_t *sizep) | ||
124 | size_t size; | ||
125 | |||
126 | /* Keep this code in sync with freadahead! */ | ||
127 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
128 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
129 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
130 | if (fp->_IO_write_ptr > fp->_IO_write_base) | ||
131 | return NULL; | ||
132 | size = fp->_IO_read_end - fp->_IO_read_ptr; | ||
133 | diff --git a/lib/freadseek.c b/lib/freadseek.c | ||
134 | index 98726f845f88..f547bfd4257b 100644 | ||
135 | --- a/lib/freadseek.c | ||
136 | +++ b/lib/freadseek.c | ||
137 | @@ -36,7 +36,8 @@ freadptrinc (FILE *fp, size_t increment) | ||
138 | /* Keep this code in sync with freadptr! */ | ||
139 | #if HAVE___FREADPTRINC /* musl libc */ | ||
140 | __freadptrinc (fp, increment); | ||
141 | -#elif defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
142 | +#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
143 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
144 | fp->_IO_read_ptr += increment; | ||
145 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | ||
146 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | ||
147 | diff --git a/lib/fseeko.c b/lib/fseeko.c | ||
148 | index 0ae2b153cff5..ee8efa49ac34 100644 | ||
149 | --- a/lib/fseeko.c | ||
150 | +++ b/lib/fseeko.c | ||
151 | @@ -47,7 +47,8 @@ fseeko (FILE *fp, off_t offset, int whence) | ||
152 | #endif | ||
153 | |||
154 | /* These tests are based on fpurge.c. */ | ||
155 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
156 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
157 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
158 | if (fp->_IO_read_end == fp->_IO_read_ptr | ||
159 | && fp->_IO_write_ptr == fp->_IO_write_base | ||
160 | && fp->_IO_save_base == NULL) | ||
161 | @@ -123,7 +124,8 @@ fseeko (FILE *fp, off_t offset, int whence) | ||
162 | return -1; | ||
163 | } | ||
164 | |||
165 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
166 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
167 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
168 | fp->_flags &= ~_IO_EOF_SEEN; | ||
169 | fp->_offset = pos; | ||
170 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | ||
171 | diff --git a/lib/fseterr.c b/lib/fseterr.c | ||
172 | index d998619771f3..23f4e3593800 100644 | ||
173 | --- a/lib/fseterr.c | ||
174 | +++ b/lib/fseterr.c | ||
175 | @@ -29,7 +29,8 @@ fseterr (FILE *fp) | ||
176 | /* Most systems provide FILE as a struct and the necessary bitmask in | ||
177 | <stdio.h>, because they need it for implementing getc() and putc() as | ||
178 | fast macros. */ | ||
179 | -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
180 | +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | ||
181 | + /* GNU libc, BeOS, Haiku, Linux libc5 */ | ||
182 | fp->_flags |= _IO_ERR_SEEN; | ||
183 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | ||
184 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | ||
185 | -- | ||
186 | 2.20.1 | ||
187 | |||