summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch')
-rw-r--r--meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch403
1 files changed, 0 insertions, 403 deletions
diff --git a/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch b/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
deleted file mode 100644
index 6347ec0b91..0000000000
--- a/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
+++ /dev/null
@@ -1,403 +0,0 @@
1From c1948ec29b8dcdc58d2d92700c325abdeab111a6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
3Date: Thu, 25 Aug 2016 13:15:00 +0100
4Subject: [PATCH 2/3] lib: switch to using strerror_l() instead of strerror_r()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9glibc provides two versions of strerror_r(), which
10can be chosen between using feature test macros
11_GNU_SOURCE and _POSIX_C_SOURCE. libnl is built using
12the former, hence we get the glibc special version,
13and all code so far has been written for this.
14
15Other C libraries like musl on the other hand only try
16to be posix compliant, and only ever provide the posix
17version of strerror_r(), which has a different signature.
18
19Uses in libnl hence generally cause printf() of an *int*
20with a *string format* specifier for that reason.
21
22Additionally, strerror_r() has been deprecated:
23 http://austingroupbugs.net/view.php?id=655
24
25Switch to using strerror_l() (via our wrapper just
26introduced).
27
28Signed-off-by: André Draszik <adraszik@tycoint.com>
29Reviewed-by: Stephane Ayotte <sayotte@tycoint.com>
30Signed-off-by: Thomas Haller <thaller@redhat.com>
31---
32Upstream-Status: Backport https://github.com/thom311/libnl/commit/c1948ec29b8dcdc58d2d92700c325abdeab111a6
33 lib/cache_mngr.c | 5 ++---
34 lib/fib_lookup/lookup.c | 3 ++-
35 lib/handlers.c | 4 ++--
36 lib/msg.c | 4 ++--
37 lib/nl.c | 26 +++++++++-----------------
38 lib/route/route_obj.c | 3 ++-
39 lib/socket.c | 33 +++++++++++----------------------
40 7 files changed, 30 insertions(+), 48 deletions(-)
41
42diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c
43index b9eb345..1f23eb1 100644
44--- a/lib/cache_mngr.c
45+++ b/lib/cache_mngr.c
46@@ -33,6 +33,7 @@
47 */
48
49 #include <netlink-private/netlink.h>
50+#include <netlink-private/utils.h>
51 #include <netlink/netlink.h>
52 #include <netlink/cache.h>
53 #include <netlink/utils.h>
54@@ -392,10 +393,8 @@ int nl_cache_mngr_poll(struct nl_cache_mngr *mngr, int timeout)
55 ret = poll(&fds, 1, timeout);
56 NL_DBG(3, "Cache manager %p, poll() returned %d\n", mngr, ret);
57 if (ret < 0) {
58- char buf[64];
59-
60 NL_DBG(4, "nl_cache_mngr_poll(%p): poll() failed with %d (%s)\n",
61- mngr, errno, strerror_r(errno, buf, sizeof(buf)));
62+ mngr, errno, nl_strerror_l(errno));
63 return -nl_syserr2nlerr(errno);
64 }
65
66diff --git a/lib/fib_lookup/lookup.c b/lib/fib_lookup/lookup.c
67index 43b6126..efc862b 100644
68--- a/lib/fib_lookup/lookup.c
69+++ b/lib/fib_lookup/lookup.c
70@@ -17,6 +17,7 @@
71 */
72
73 #include <netlink-private/netlink.h>
74+#include <netlink-private/utils.h>
75 #include <netlink/netlink.h>
76 #include <netlink/attr.h>
77 #include <netlink/utils.h>
78@@ -133,7 +134,7 @@ static void result_dump_line(struct nl_object *obj, struct nl_dump_params *p)
79 nl_rtntype2str(res->fr_type, buf, sizeof(buf)));
80 nl_dump(p, "scope %s error %s (%d)\n",
81 rtnl_scope2str(res->fr_scope, buf, sizeof(buf)),
82- strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error);
83+ nl_strerror_l(-res->fr_error), res->fr_error);
84 }
85
86 static void result_dump_details(struct nl_object *obj, struct nl_dump_params *p)
87diff --git a/lib/handlers.c b/lib/handlers.c
88index 97a0d9c..4a48b99 100644
89--- a/lib/handlers.c
90+++ b/lib/handlers.c
91@@ -26,6 +26,7 @@
92 */
93
94 #include <netlink-private/netlink.h>
95+#include <netlink-private/utils.h>
96 #include <netlink/netlink.h>
97 #include <netlink/utils.h>
98 #include <netlink/msg.h>
99@@ -79,10 +80,9 @@ static int nl_error_handler_verbose(struct sockaddr_nl *who,
100 struct nlmsgerr *e, void *arg)
101 {
102 FILE *ofd = arg ? arg : stderr;
103- char buf[256];
104
105 fprintf(ofd, "-- Error received: %s\n-- Original message: ",
106- strerror_r(-e->error, buf, sizeof(buf)));
107+ nl_strerror_l(-e->error));
108 print_header_content(ofd, &e->msg);
109 fprintf(ofd, "\n");
110
111diff --git a/lib/msg.c b/lib/msg.c
112index e8a7e99..9af3f3a 100644
113--- a/lib/msg.c
114+++ b/lib/msg.c
115@@ -27,6 +27,7 @@
116 */
117
118 #include <netlink-private/netlink.h>
119+#include <netlink-private/utils.h>
120 #include <netlink/netlink.h>
121 #include <netlink/utils.h>
122 #include <netlink/cache.h>
123@@ -913,11 +914,10 @@ static void dump_error_msg(struct nl_msg *msg, FILE *ofd)
124 fprintf(ofd, " [ERRORMSG] %zu octets\n", sizeof(*err));
125
126 if (nlmsg_len(hdr) >= sizeof(*err)) {
127- char buf[256];
128 struct nl_msg *errmsg;
129
130 fprintf(ofd, " .error = %d \"%s\"\n", err->error,
131- strerror_r(-err->error, buf, sizeof(buf)));
132+ nl_strerror_l(-err->error));
133 fprintf(ofd, " [ORIGINAL MESSAGE] %zu octets\n", sizeof(*hdr));
134
135 errmsg = nlmsg_inherit(&err->msg);
136diff --git a/lib/nl.c b/lib/nl.c
137index 123f657..a45c3ea 100644
138--- a/lib/nl.c
139+++ b/lib/nl.c
140@@ -27,6 +27,7 @@
141
142 #include <netlink-private/netlink.h>
143 #include <netlink-private/socket.h>
144+#include <netlink-private/utils.h>
145 #include <netlink/netlink.h>
146 #include <netlink/utils.h>
147 #include <netlink/handlers.h>
148@@ -105,7 +106,6 @@ int nl_connect(struct nl_sock *sk, int protocol)
149 int errsv;
150 socklen_t addrlen;
151 struct sockaddr_nl local = { 0 };
152- char buf[64];
153 int try_bind = 1;
154
155 #ifdef SOCK_CLOEXEC
156@@ -119,7 +119,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
157 if (sk->s_fd < 0) {
158 errsv = errno;
159 NL_DBG(4, "nl_connect(%p): socket() failed with %d (%s)\n", sk, errsv,
160- strerror_r(errsv, buf, sizeof(buf)));
161+ nl_strerror_l(errsv));
162 err = -nl_syserr2nlerr(errsv);
163 goto errout;
164 }
165@@ -158,7 +158,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
166 _nl_socket_used_ports_set(used_ports, port);
167 } else {
168 NL_DBG(4, "nl_connect(%p): bind() for port %u failed with %d (%s)\n",
169- sk, (unsigned) port, errsv, strerror_r(errsv, buf, sizeof(buf)));
170+ sk, (unsigned) port, errsv, nl_strerror_l(errsv));
171 _nl_socket_used_ports_release_all(used_ports);
172 err = -nl_syserr2nlerr(errsv);
173 goto errout;
174@@ -172,7 +172,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
175 if (err != 0) {
176 errsv = errno;
177 NL_DBG(4, "nl_connect(%p): bind() failed with %d (%s)\n",
178- sk, errsv, strerror_r(errsv, buf, sizeof(buf)));
179+ sk, errsv, nl_strerror_l(errsv));
180 err = -nl_syserr2nlerr(errsv);
181 goto errout;
182 }
183@@ -183,7 +183,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
184 &addrlen);
185 if (err < 0) {
186 NL_DBG(4, "nl_connect(%p): getsockname() failed with %d (%s)\n",
187- sk, errno, strerror_r(errno, buf, sizeof(buf)));
188+ sk, errno, nl_strerror_l(errno));
189 err = -nl_syserr2nlerr(errno);
190 goto errout;
191 }
192@@ -280,10 +280,8 @@ int nl_sendto(struct nl_sock *sk, void *buf, size_t size)
193 ret = sendto(sk->s_fd, buf, size, 0, (struct sockaddr *)
194 &sk->s_peer, sizeof(sk->s_peer));
195 if (ret < 0) {
196- char errbuf[64];
197-
198 NL_DBG(4, "nl_sendto(%p): sendto() failed with %d (%s)\n",
199- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
200+ sk, errno, nl_strerror_l(errno));
201 return -nl_syserr2nlerr(errno);
202 }
203
204@@ -343,10 +341,8 @@ int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)
205
206 ret = sendmsg(sk->s_fd, hdr, 0);
207 if (ret < 0) {
208- char errbuf[64];
209-
210 NL_DBG(4, "nl_sendmsg(%p): sendmsg() failed with %d (%s)\n",
211- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
212+ sk, errno, nl_strerror_l(errno));
213 return -nl_syserr2nlerr(errno);
214 }
215
216@@ -706,15 +702,13 @@ retry:
217 goto abort;
218 }
219 if (n < 0) {
220- char errbuf[64];
221-
222 if (errno == EINTR) {
223 NL_DBG(3, "recvmsg() returned EINTR, retrying\n");
224 goto retry;
225 }
226
227 NL_DBG(4, "nl_sendmsg(%p): nl_recv() failed with %d (%s)\n",
228- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
229+ sk, errno, nl_strerror_l(errno));
230 retval = -nl_syserr2nlerr(errno);
231 goto abort;
232 }
233@@ -980,10 +974,8 @@ continue_reading:
234 goto out;
235 }
236 } else if (e->error) {
237- char buf[64];
238-
239 NL_DBG(4, "recvmsgs(%p): RTNETLINK responded with %d (%s)\n",
240- sk, -e->error, strerror_r(-e->error, buf, sizeof(buf)));
241+ sk, -e->error, nl_strerror_l(-e->error));
242
243 /* Error message reported back from kernel. */
244 if (cb->cb_err) {
245diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
246index 7347ed2..21b67b1 100644
247--- a/lib/route/route_obj.c
248+++ b/lib/route/route_obj.c
249@@ -31,6 +31,7 @@
250 */
251
252 #include <netlink-private/netlink.h>
253+#include <netlink-private/utils.h>
254 #include <netlink/netlink.h>
255 #include <netlink/cache.h>
256 #include <netlink/utils.h>
257@@ -259,7 +260,7 @@ static void route_dump_details(struct nl_object *a, struct nl_dump_params *p)
258 if ((r->ce_mask & ROUTE_ATTR_CACHEINFO) && r->rt_cacheinfo.rtci_error) {
259 nl_dump_line(p, " cacheinfo error %d (%s)\n",
260 r->rt_cacheinfo.rtci_error,
261- strerror_r(-r->rt_cacheinfo.rtci_error, buf, sizeof(buf)));
262+ nl_strerror_l(-r->rt_cacheinfo.rtci_error));
263 }
264
265 if (r->ce_mask & ROUTE_ATTR_METRICS) {
266diff --git a/lib/socket.c b/lib/socket.c
267index 97b2f69..55153b4 100644
268--- a/lib/socket.c
269+++ b/lib/socket.c
270@@ -33,6 +33,7 @@
271
272 #include <netlink-private/netlink.h>
273 #include <netlink-private/socket.h>
274+#include <netlink-private/utils.h>
275 #include <netlink/netlink.h>
276 #include <netlink/utils.h>
277 #include <netlink/handlers.h>
278@@ -449,11 +450,9 @@ int nl_socket_add_memberships(struct nl_sock *sk, int group, ...)
279 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
280 &group, sizeof(group));
281 if (err < 0) {
282- char buf[64];
283-
284 va_end(ap);
285 NL_DBG(4, "nl_socket_add_memberships(%p): setsockopt() failed with %d (%s)\n",
286- sk, errno, strerror_r(errno, buf, sizeof(buf)));
287+ sk, errno, nl_strerror_l(errno));
288 return -nl_syserr2nlerr(errno);
289 }
290
291@@ -501,11 +500,9 @@ int nl_socket_drop_memberships(struct nl_sock *sk, int group, ...)
292 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
293 &group, sizeof(group));
294 if (err < 0) {
295- char buf[64];
296-
297 va_end(ap);
298 NL_DBG(4, "nl_socket_drop_memberships(%p): setsockopt() failed with %d (%s)\n",
299- sk, errno, strerror_r(errno, buf, sizeof(buf)));
300+ sk, errno, nl_strerror_l(errno));
301 return -nl_syserr2nlerr(errno);
302 }
303
304@@ -619,7 +616,6 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
305 {
306 int err = 0;
307 socklen_t addrlen;
308- char buf[64];
309 struct sockaddr_nl local = { 0 };
310 int so_type = -1, so_protocol = -1;
311
312@@ -633,7 +629,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
313 &addrlen);
314 if (err < 0) {
315 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockname() failed with %d (%s)\n",
316- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
317+ sk, fd, errno, nl_strerror_l(errno));
318 return -nl_syserr2nlerr(errno);
319 }
320 if (addrlen != sizeof(local))
321@@ -648,7 +644,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
322 err = getsockopt(fd, SOL_SOCKET, SO_TYPE, &so_type, &addrlen);
323 if (err < 0) {
324 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_TYPE failed with %d (%s)\n",
325- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
326+ sk, fd, errno, nl_strerror_l(errno));
327 return -nl_syserr2nlerr(errno);
328 }
329 if (addrlen != sizeof(so_type))
330@@ -666,7 +662,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
331 if (errno == ENOPROTOOPT)
332 goto no_so_protocol;
333 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_PROTOCOL failed with %d (%s)\n",
334- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
335+ sk, fd, errno, nl_strerror_l(errno));
336 return -nl_syserr2nlerr(errno);
337 }
338 if (addrlen != sizeof(so_protocol))
339@@ -709,10 +705,8 @@ int nl_socket_set_nonblocking(const struct nl_sock *sk)
340 return -NLE_BAD_SOCK;
341
342 if (fcntl(sk->s_fd, F_SETFL, O_NONBLOCK) < 0) {
343- char buf[64];
344-
345 NL_DBG(4, "nl_socket_set_nonblocking(%p): fcntl() failed with %d (%s)\n",
346- sk, errno, strerror_r(errno, buf, sizeof(buf)));
347+ sk, errno, nl_strerror_l(errno));
348 return -nl_syserr2nlerr(errno);
349 }
350
351@@ -813,7 +807,6 @@ int nl_socket_modify_err_cb(struct nl_sock *sk, enum nl_cb_kind kind,
352 int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
353 {
354 int err;
355- char buf[64];
356
357 if (rxbuf <= 0)
358 rxbuf = 32768;
359@@ -828,7 +821,7 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
360 &txbuf, sizeof(txbuf));
361 if (err < 0) {
362 NL_DBG(4, "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
363- sk, errno, strerror_r(errno, buf, sizeof(buf)));
364+ sk, errno, nl_strerror_l(errno));
365 return -nl_syserr2nlerr(errno);
366 }
367
368@@ -836,7 +829,7 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
369 &rxbuf, sizeof(rxbuf));
370 if (err < 0) {
371 NL_DBG(4, "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
372- sk, errno, strerror_r(errno, buf, sizeof(buf)));
373+ sk, errno, nl_strerror_l(errno));
374 return -nl_syserr2nlerr(errno);
375 }
376
377@@ -890,10 +883,8 @@ int nl_socket_set_passcred(struct nl_sock *sk, int state)
378 err = setsockopt(sk->s_fd, SOL_SOCKET, SO_PASSCRED,
379 &state, sizeof(state));
380 if (err < 0) {
381- char buf[64];
382-
383 NL_DBG(4, "nl_socket_set_passcred(%p): setsockopt() failed with %d (%s)\n",
384- sk, errno, strerror_r(errno, buf, sizeof(buf)));
385+ sk, errno, nl_strerror_l(errno));
386 return -nl_syserr2nlerr(errno);
387 }
388
389@@ -922,10 +913,8 @@ int nl_socket_recv_pktinfo(struct nl_sock *sk, int state)
390 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_PKTINFO,
391 &state, sizeof(state));
392 if (err < 0) {
393- char buf[64];
394-
395 NL_DBG(4, "nl_socket_recv_pktinfo(%p): setsockopt() failed with %d (%s)\n",
396- sk, errno, strerror_r(errno, buf, sizeof(buf)));
397+ sk, errno, nl_strerror_l(errno));
398 return -nl_syserr2nlerr(errno);
399 }
400
401--
4022.9.3
403