diff options
Diffstat (limited to 'meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch')
-rw-r--r-- | meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch index 851fe57569..a575d0ebce 100644 --- a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch +++ b/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch | |||
@@ -1,25 +1,24 @@ | |||
1 | From 0a8e50f7322832efdaf33da87839fbba05a755de Mon Sep 17 00:00:00 2001 | 1 | From 4d9b6ec30b78d00ead0a22eb5d047dcdba37e99c Mon Sep 17 00:00:00 2001 |
2 | From: "Maxin B. John" <maxin.john@intel.com> | 2 | From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= |
3 | Date: Mon, 21 Nov 2016 11:46:00 +0200 | 3 | =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?= |
4 | Subject: [PATCH] Add fallback fopencookie() implementation | 4 | <ngompa13@gmail.com> |
5 | MIME-Version: 1.0 | 5 | Date: Wed, 11 Nov 2015 20:32:17 -0500 |
6 | Content-Type: text/plain; charset=UTF-8 | 6 | Subject: [PATCH 1/2] Add fallback fopencookie() implementation |
7 | Content-Transfer-Encoding: 8bit | ||
8 | 7 | ||
9 | In environments where neither fopencookie() nor funopen() | 8 | In environments where neither fopencookie() nor funopen() |
10 | are implemented, we need to provide a suitable implementation | 9 | are implemented, we need to provide a suitable implementation |
11 | of fopencookie() that we can use. | 10 | of fopencookie() that we can use. |
12 | 11 | ||
13 | Upstream-Status: Denied [ https://github.com/openSUSE/libsolv/pull/112 ] | 12 | Alex Kanavin: rebased CMakeLists.txt change to apply to latest upstream code. |
14 | 13 | ||
15 | Signed-off-by: Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com> | 14 | Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112] |
16 | Signed-off-by: Maxin B. John <maxin.john@intel.com> | 15 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
17 | --- | 16 | --- |
18 | ext/CMakeLists.txt | 7 ++ | 17 | ext/CMakeLists.txt | 7 ++ |
19 | ext/solv_xfopen.c | 10 +-- | 18 | ext/solv_xfopen.c | 10 +-- |
20 | ext/solv_xfopen_fallback_fopencookie.c | 124 +++++++++++++++++++++++++++++++++ | 19 | ext/solv_xfopen_fallback_fopencookie.c | 123 +++++++++++++++++++++++++++++++++ |
21 | ext/solv_xfopen_fallback_fopencookie.h | 28 ++++++++ | 20 | ext/solv_xfopen_fallback_fopencookie.h | 28 ++++++++ |
22 | 4 files changed, 165 insertions(+), 4 deletions(-) | 21 | 4 files changed, 164 insertions(+), 4 deletions(-) |
23 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.c | 22 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.c |
24 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.h | 23 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.h |
25 | 24 | ||
@@ -85,17 +84,17 @@ index b0421bf..31345dd 100644 | |||
85 | 84 | ||
86 | diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c | 85 | diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c |
87 | new file mode 100644 | 86 | new file mode 100644 |
88 | index 0000000..89426a9 | 87 | index 0000000..0ce2571 |
89 | --- /dev/null | 88 | --- /dev/null |
90 | +++ b/ext/solv_xfopen_fallback_fopencookie.c | 89 | +++ b/ext/solv_xfopen_fallback_fopencookie.c |
91 | @@ -0,0 +1,124 @@ | 90 | @@ -0,0 +1,123 @@ |
92 | +/* | 91 | +/* |
93 | + * Provides a very limited fopencookie() for environments with a libc | 92 | + * Provides a very limited fopencookie() for environments with a libc |
94 | + * that lacks it. | 93 | + * that lacks it. |
95 | + * | 94 | + * |
96 | + * Authors: zhasha & nsz | 95 | + * Author: zhasha |
97 | + * Modified for libsolv by Neal Gompa | 96 | + * Modified for libsolv by Neal Gompa |
98 | + * | 97 | + * |
99 | + * This program is licensed under the BSD license, read LICENSE.BSD | 98 | + * This program is licensed under the BSD license, read LICENSE.BSD |
100 | + * for further information. | 99 | + * for further information. |
101 | + * | 100 | + * |
@@ -124,7 +123,7 @@ index 0000000..89426a9 | |||
124 | +{ | 123 | +{ |
125 | + struct ctx *ctx = arg; | 124 | + struct ctx *ctx = arg; |
126 | + ssize_t r; | 125 | + ssize_t r; |
127 | + size_t n, k; | 126 | + size_t n; |
128 | + | 127 | + |
129 | + pthread_detach(pthread_self()); | 128 | + pthread_detach(pthread_self()); |
130 | + | 129 | + |
@@ -138,18 +137,17 @@ index 0000000..89426a9 | |||
138 | + } | 137 | + } |
139 | + if (r == 0) { break; } | 138 | + if (r == 0) { break; } |
140 | + | 139 | + |
141 | + n = r, k = 0; | ||
142 | + while (n > 0) { | 140 | + while (n > 0) { |
143 | + r = ctx->io.write ? | 141 | + r = ctx->io.write ? |
144 | + (ctx->io.write)(ctx->cookie, ctx->buf + k, n) : | 142 | + (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) : |
145 | + write(ctx->fd, ctx->buf + k, n); | 143 | + write(ctx->fd, ctx->buf + ((size_t)r - n), n); |
146 | + if (r < 0) { | 144 | + if (r < 0) { |
147 | + if (errno != EINTR) { break; } | 145 | + if (errno != EINTR) { break; } |
148 | + continue; | 146 | + continue; |
149 | + } | 147 | + } |
150 | + if (r == 0) { break; } | 148 | + if (r == 0) { break; } |
151 | + | 149 | + |
152 | + n -= r, k += r; | 150 | + n -= (size_t)r; |
153 | + } | 151 | + } |
154 | + if (n > 0) { break; } | 152 | + if (n > 0) { break; } |
155 | + } | 153 | + } |
@@ -169,8 +167,8 @@ index 0000000..89426a9 | |||
169 | + | 167 | + |
170 | + switch (mode[0]) { | 168 | + switch (mode[0]) { |
171 | + case 'a': | 169 | + case 'a': |
172 | + case 'w': wr = 1; break; | ||
173 | + case 'r': rd = 1; break; | 170 | + case 'r': rd = 1; break; |
171 | + case 'w': wr = 1; break; | ||
174 | + default: | 172 | + default: |
175 | + errno = EINVAL; | 173 | + errno = EINVAL; |
176 | + return NULL; | 174 | + return NULL; |
@@ -215,20 +213,20 @@ index 0000000..89426a9 | |||
215 | +} | 213 | +} |
216 | diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h | 214 | diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h |
217 | new file mode 100644 | 215 | new file mode 100644 |
218 | index 0000000..7223e3f | 216 | index 0000000..6a7bfee |
219 | --- /dev/null | 217 | --- /dev/null |
220 | +++ b/ext/solv_xfopen_fallback_fopencookie.h | 218 | +++ b/ext/solv_xfopen_fallback_fopencookie.h |
221 | @@ -0,0 +1,28 @@ | 219 | @@ -0,0 +1,28 @@ |
222 | +/* | 220 | +/* |
223 | + * Provides a very limited fopencookie() for environments with a libc | 221 | + * Provides a very limited fopencookie() for environments with a libc |
224 | + * that lacks it. | 222 | + * that lacks it. |
225 | + * | 223 | + * |
226 | + * Authors: zhasha & nsz | 224 | + * Author: zhasha |
227 | + * Modified for libsolv by Neal Gompa | 225 | + * Modified for libsolv by Neal Gompa |
228 | + * | 226 | + * |
229 | + * This program is licensed under the BSD license, read LICENSE.BSD | 227 | + * This program is licensed under the BSD license, read LICENSE.BSD |
230 | + * for further information. | 228 | + * for further information. |
231 | + * | 229 | + * |
232 | + */ | 230 | + */ |
233 | + | 231 | + |
234 | +#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H | 232 | +#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H |
@@ -248,5 +246,5 @@ index 0000000..7223e3f | |||
248 | + | 246 | + |
249 | +#endif | 247 | +#endif |
250 | -- | 248 | -- |
251 | 2.4.0 | 249 | 2.11.0 |
252 | 250 | ||