summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch')
-rw-r--r--meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
new file mode 100644
index 0000000000..efb4e3ad7e
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
@@ -0,0 +1,104 @@
1From 99b10cdf6a0f8a24e1670c1813b1d9563ae3f5b5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?=
3 =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?=
4 <ngompa13@gmail.com>
5Date: Mon, 23 Nov 2015 18:19:41 -0500
6Subject: [PATCH 2/2] Fixes to internal fopencookie() implementation
7
8Credits to the fixes go to nsz on #musl on Freenode,
9who gloriously fixed the implementation such that
10the tests all pass.
11
12Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112]
13Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
14---
15 ext/solv_xfopen_fallback_fopencookie.c | 19 ++++++++++---------
16 ext/solv_xfopen_fallback_fopencookie.h | 10 +++++-----
17 2 files changed, 15 insertions(+), 14 deletions(-)
18
19diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c
20index 0ce2571..89426a9 100644
21--- a/ext/solv_xfopen_fallback_fopencookie.c
22+++ b/ext/solv_xfopen_fallback_fopencookie.c
23@@ -1,10 +1,10 @@
24-/*
25+/*
26 * Provides a very limited fopencookie() for environments with a libc
27 * that lacks it.
28- *
29- * Author: zhasha
30+ *
31+ * Authors: zhasha & nsz
32 * Modified for libsolv by Neal Gompa
33- *
34+ *
35 * This program is licensed under the BSD license, read LICENSE.BSD
36 * for further information.
37 *
38@@ -33,7 +33,7 @@ static void *proxy(void *arg)
39 {
40 struct ctx *ctx = arg;
41 ssize_t r;
42- size_t n;
43+ size_t n, k;
44
45 pthread_detach(pthread_self());
46
47@@ -47,17 +47,18 @@ static void *proxy(void *arg)
48 }
49 if (r == 0) { break; }
50
51+ n = r, k = 0;
52 while (n > 0) {
53 r = ctx->io.write ?
54- (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) :
55- write(ctx->fd, ctx->buf + ((size_t)r - n), n);
56+ (ctx->io.write)(ctx->cookie, ctx->buf + k, n) :
57+ write(ctx->fd, ctx->buf + k, n);
58 if (r < 0) {
59 if (errno != EINTR) { break; }
60 continue;
61 }
62 if (r == 0) { break; }
63
64- n -= (size_t)r;
65+ n -= r, k += r;
66 }
67 if (n > 0) { break; }
68 }
69@@ -77,8 +78,8 @@ FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t i
70
71 switch (mode[0]) {
72 case 'a':
73- case 'r': rd = 1; break;
74 case 'w': wr = 1; break;
75+ case 'r': rd = 1; break;
76 default:
77 errno = EINVAL;
78 return NULL;
79diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h
80index 6a7bfee..7223e3f 100644
81--- a/ext/solv_xfopen_fallback_fopencookie.h
82+++ b/ext/solv_xfopen_fallback_fopencookie.h
83@@ -1,13 +1,13 @@
84-/*
85+/*
86 * Provides a very limited fopencookie() for environments with a libc
87 * that lacks it.
88- *
89- * Author: zhasha
90+ *
91+ * Authors: zhasha & nsz
92 * Modified for libsolv by Neal Gompa
93- *
94+ *
95 * This program is licensed under the BSD license, read LICENSE.BSD
96 * for further information.
97- *
98+ *
99 */
100
101 #ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
102--
1032.11.0
104